Final part 1 done
This commit is contained in:
parent
3125f9642e
commit
706d225e78
@ -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())));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user