Question: 1 2 . 1 2 LAB * : Warm up: Online shopping cart ( Part 1 ) ( 1 ) Build the ItemToPurchase class with
LAB: Warm up: Online shopping cart Part
Build the ItemToPurchase class with the following specifications:
Attributes pts
itemname string
itemprice float
itemquantity int
Default constructor pt
Initializes item's name "none", item's price item's quantity
Method
printitemcost
Ex of printitemcost output:
Bottled Water @ $ $
In the main section of your code, prompt the user for two items and create two objects of the ItemToPurchase class. pts
Ex:
Item
Enter the item name:
Chocolate Chips
Enter the item price:
Enter the item quantity:
Item
Enter the item name:
Bottled Water
Enter the item price:
Enter the item quantity:
Add the costs of the two items together and output the total cost. pts
Ex:
TOTAL COST
Chocolate Chips @ $ $
Bottled Water @ $ $
Total: $
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
