Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started