diff --git a/Week-11-final-start/part-1/ShoppingCartPrinter.java b/Week-11-final-start/part-1/ShoppingCartPrinter.java index 12dd1b9..7d8f3d2 100644 --- a/Week-11-final-start/part-1/ShoppingCartPrinter.java +++ b/Week-11-final-start/part-1/ShoppingCartPrinter.java @@ -44,12 +44,21 @@ public class ShoppingCartPrinter { System.out.println("Item 1"); System.out.println("Enter the item name:"); item1.setName(scnr.nextLine()); + System.out.println("Enter the item price:"); + item1.setPrice(scnr.nextInt()); + System.out.println("Enter the item quantity:"); + item1.setQuantity(scnr.nextInt()); + scnr.nextLine(); - System.out.println("Item 2"); + System.out.println("\nItem 2"); System.out.println("Enter the item name:"); item2.setName(scnr.nextLine()); + System.out.println("Enter the item price:"); + item2.setPrice(scnr.nextInt()); + System.out.println("Enter the item quantity:"); + item2.setQuantity(scnr.nextInt()); - System.out.println("TOTAL COST"); + System.out.println("\nTOTAL COST"); System.out.println(item1.getName() + " " + item1.getQuantity() + " @ $" + item1.getPrice() + " = $" + (item1.getPrice() * item1.getQuantity())); @@ -57,14 +66,9 @@ public class ShoppingCartPrinter { System.out.println(item2.getName() + " " + item2.getQuantity() + " @ $" + item2.getPrice() + " = $" + (item2.getPrice() * item2.getQuantity())); - System.out.println("\n Total: $" + + System.out.println("\nTotal: $" + ((item2.getPrice() * item2.getQuantity()) + - (item1.getPrice() * item2.getQuantity()))); - - scnr.close(); - - - - + (item1.getPrice() * item1.getQuantity()))); } } +