(cancel1 = 2) ブール値の「cancel」が読み取られないコードの部分:
while (done !=0){
pizzaChoice = readInt ("Choose the type of pizza you wish to order");
double quantity = readInt ("How many " + type[pizzaChoice] + " pizzas do you wish to buy (Maximum pizzas per order is 5)");
if(quantity >= max){
System.out.println("Sorry you cannot order more than five pizzas");
if ((quantity - max) <= 0){
double pizzasLeft = max - quantity;
System.out.println("You can still order " + pizzasLeft + " pizzas");
pizzasLeft2 = pizzasLeft2 - pizzasLeft;
この次の if ループが問題の場所です
if (pizzasLeft2 <= 0){
boolean cancel = true;
int cancel1 = readInt("Press 2 to cancel your order and start again");
if(cancel1 == 2){
cancel = false;
}
}
}
}
done= readInt ("Press 0 if you are done or press 1 to make another pizza order");
double total1 = quantity*price[pizzaChoice];
total2 = total2 + total1;
}