Print menu only once

This commit is contained in:
Logen Kain 2020-11-11 14:40:49 -05:00
parent 7dfedb2f16
commit af7220b0d5

View File

@ -23,14 +23,14 @@ public class ShoppingCartManager {
char userInput; char userInput;
userInput = 0; userInput = 0;
System.out.println("MENU\n"+
"a - Add item to cart\n"+
"d - Remove item from cart\n"+
"c - Change item quantity\n"+
"i - Output items' descriptions\n"+
"o - Output shopping cart\n"+
"q - Quit");
while (userInput != 'q'){ while (userInput != 'q'){
System.out.println("MENU\n"+
"a - Add item to cart\n"+
"d - Remove item from cart\n"+
"c - Change item quantity\n"+
"i - Output items' descriptions\n"+
"o - Output shopping cart\n"+
"q - Quit");
userInput = scnr.next().charAt(0); userInput = scnr.next().charAt(0);
scnr.nextLine(); scnr.nextLine();
switch (userInput) { switch (userInput) {