case 2:
System.out.println();
ctr2=1;
System.out.println("Select products and add to cart");
for(ctr=0;ctr<nList;ctr++)
{
System.out.println(ctr2 + ". " + itemArray[ctr] + " " + priceArray[ctr]);
ctr2++;
}
System.out.println();
System.out.println("Enter the number of item you want to purchase: ");
int itemPur = Integer.parseInt(a.readLine());
System.out.println("Choose the product you want to add to cart");
for(ctr1=0;ctr1<itemPur;ctr1++)
{
System.out.println("Enter your choice: ");
choice1=a.readLine();
for(ctr=0;ctr<itemPur;ctr++)
{
if(choice1.equalsIgnoreCase(itemArray[ctr]))
cartArray[ctr1]=choice1;
ctr1++;
}
}
is this code right for storing choices?
for(ctr1=0;ctr1<itemPur;ctr1++)
{
System.out.println(cartArray[ctr1] + " " + priceArray[ctr1]);
double totalPur = 0;
totalPur = totalPur + priceArray[ctr1];
}
System.out.println("Your total cost is " + totalPur);
ctr2=ctr2-ctr2;
break;
Why does my variable "totalPur" is not recognize if i build the file..
this is just a continuation of the upper part code..