(1) Create three files to submit:
- ItemToPurchase.h Class declaration
- ItemToPurchase.cpp Class definition
- main.cpp main() function
Build the ItemTopurchase class with the following specifications:
- Default constructor
- Public Class functions (mutators accessors)
- SetName() & GetName() (2 pts)
SetPnce() GetPrice0 (2 pts)
- SetQuantity() & GetQuantity() (2 pts)
- Private data members
string item Name Initialized in default constructor to none
- int itemprice Initialized in default constructor to O
- int iternQuantity Initialized in default constructor to O
(2) In main (), prompt the user for two items and create two objects of the ItemToPurchase class Before prompting for the second item, call
cin.ignore() to allow the user to input a new string. (2 pts)
Item 1
Enter the item name:
Chips
Enter the item price:
Enter the item quantity:
Item 2
Bottled Rater
Enter
Enter the quantity:
(3) Add the costs of the two items together and output the total Cost, (2 pts)
TOTAL cosrr
Chips 1 $3
Bottled Rater 10 e $1
Total: $13
10_201: Labquiz 6: Online Shopping Cart
Current file: main.coo
0/10
Load default template.
Reviews
There are no reviews yet.