Fuck the autograder
This commit is contained in:
parent
af7220b0d5
commit
b694a9e6e2
@ -72,13 +72,13 @@ public class ShoppingCart {
|
||||
}
|
||||
|
||||
public void printTotal(){
|
||||
if (cartItems.size() == 0){
|
||||
System.out.println("SHOPPING CART IS EMPTY");
|
||||
return;
|
||||
}
|
||||
printNameDate();
|
||||
System.out.println("Number of Items: " + cartItems.size());
|
||||
System.out.println();
|
||||
if (cartItems.size() == 0){
|
||||
System.out.println("SHOPPING CART IS EMPTY");
|
||||
}
|
||||
System.out.println();
|
||||
|
||||
for (int i=0; i<cartItems.size(); i++){
|
||||
System.out.println(cartItems.get(i).getName() + " " +
|
||||
|
@ -14,15 +14,43 @@ public class ShoppingCartManager {
|
||||
System.out.println();
|
||||
System.out.println("Customer Name: "+custName);
|
||||
System.out.println("Today's Date: "+curDate);
|
||||
System.out.println();
|
||||
|
||||
printMenu(cart, scnr);
|
||||
}
|
||||
|
||||
public static void printMenu(ShoppingCart cart, Scanner scnr){
|
||||
printMenu();
|
||||
|
||||
char userInput;
|
||||
userInput = 0;
|
||||
|
||||
while (userInput != 'q'){
|
||||
userInput = scnr.next().charAt(0);
|
||||
switch (userInput) {
|
||||
case 'a': addItem(cart, scnr);
|
||||
userInput = 0;
|
||||
printMenu();
|
||||
break;
|
||||
case 'd': removeItem(cart, scnr);
|
||||
userInput = 0;
|
||||
printMenu();
|
||||
break;
|
||||
case 'c': changeItemQuantity(cart, scnr);
|
||||
userInput = 0;
|
||||
printMenu();
|
||||
break;
|
||||
case 'i': printDesc(cart);
|
||||
userInput = 0;
|
||||
printMenu();
|
||||
break;
|
||||
case 'o': outputCart(cart);
|
||||
userInput = 0;
|
||||
printMenu();
|
||||
break;
|
||||
default:
|
||||
System.out.println("Choose an option:");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void printMenu(){
|
||||
System.out.println("MENU\n"+
|
||||
"a - Add item to cart\n"+
|
||||
"d - Remove item from cart\n"+
|
||||
@ -30,25 +58,7 @@ public class ShoppingCartManager {
|
||||
"i - Output items' descriptions\n"+
|
||||
"o - Output shopping cart\n"+
|
||||
"q - Quit");
|
||||
while (userInput != 'q'){
|
||||
userInput = scnr.next().charAt(0);
|
||||
scnr.nextLine();
|
||||
switch (userInput) {
|
||||
case 'a': addItem(cart, scnr);
|
||||
break;
|
||||
case 'd': removeItem(cart, scnr);
|
||||
break;
|
||||
case 'c': changeItemQuantity(cart, scnr);
|
||||
break;
|
||||
case 'i': printDesc(cart);
|
||||
break;
|
||||
case 'o': outputCart(cart);
|
||||
break;
|
||||
default:
|
||||
System.out.println("Choose an option:");
|
||||
|
||||
}
|
||||
}
|
||||
System.out.println();
|
||||
}
|
||||
|
||||
public static void addItem(ShoppingCart cart, Scanner scnr){
|
||||
@ -89,7 +99,6 @@ public class ShoppingCartManager {
|
||||
public static void outputCart(ShoppingCart cart){
|
||||
System.out.println("OUTPUT SHOPPING CART");
|
||||
cart.printTotal();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user