42 lines
710 B
Java
42 lines
710 B
Java
|
/*
|
||
|
In main, ask the user for two items and create two objects of the
|
||
|
ItemToPurchase class.
|
||
|
|
||
|
Before asking for the second item, call scnr.nextLine()
|
||
|
to allow the user to put in a new string.
|
||
|
|
||
|
Example:
|
||
|
Item 1
|
||
|
Enter the item name:
|
||
|
Chocolate Chips
|
||
|
Enter the item price:
|
||
|
3
|
||
|
Enter the item quantity:
|
||
|
1
|
||
|
|
||
|
Item 2
|
||
|
Enter the item name:
|
||
|
Bottled Water
|
||
|
Enter the item price:
|
||
|
1
|
||
|
Enter the item quantity:
|
||
|
10
|
||
|
Then add the costs of teh two items together and output
|
||
|
the total cost
|
||
|
|
||
|
Example:
|
||
|
TOTAL COST
|
||
|
Chocolate Chips 1 @ $3 = $3
|
||
|
Bottled Water 10 @ $1 = $10
|
||
|
|
||
|
Total: $13
|
||
|
*/
|
||
|
|
||
|
import java.util.Scanner;
|
||
|
|
||
|
public class ShoppingCartPrinter {
|
||
|
public static void main(String[] args) {
|
||
|
Scanner scnr = new Scanner(System.in);
|
||
|
}
|
||
|
}
|