Question: Build an ItemToPurchase class with the following specifications: Attributes ( 3 pts ) item _ name ( string ) item _ price ( float )
Build an 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
Example 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.
Example:
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.
Example:
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
