public void addPizza() throws FileNotFoundException {
Menu menu = new Menu();
Map<Integer, Pizza> pizzaMenu = menu.getPizzaMenu();
boolean exit = false;
while (!exit) {
String input1;
String input2;
System.out.println("What pizza");
input1 = sc.nextLine();
System.out.println("How many pizzas");
input2 = sc.nextLine();
if (input1.equals("Quit") || input1.equals("quit") || input2.equals("Quit") || input2.equals("quit")) {
exit = true;
} else {
Pizza pizza = pizzaMenu.get(Integer.parseInt(input1));
Integer quantity = Integer.parseInt(input2);
OrderLineItem orderLine = new OrderLineItem(pizza,quantity,"");
listOfOrderLineItems.add(orderLine);
Hello. I've got the above code, however my loop will not exit correctly. As it stands now, It'll ask you "What pizza" -> input Quit -> "How many pizzas" -> input Quit. The idea is that it just quits the loop after typing Quit once, either in the What pizza or How many pizzas.
IMO it should exit after just one "Quit", since the if statement should set the boolean to true? Hope anyone can help.
Kind regards