Page 1 of 1

PLEASE ANSWER IN C++

Posted: Sun Jul 03, 2022 11:22 am
by answerhappygod
PLEASE ANSWER IN C++
Please Answer In C 1
Please Answer In C 1 (70.29 KiB) Viewed 19 times
7.21 LAB*: Program: Online shopping cart (Part 1) (1) Create three files to submit: • Item ToPurchase.h - Class declaration • Item To Purchase.cpp - Class definition • main.cpp - main() function Build the Item ToPurchase class with the following specifications: • Default constructor • Public class functions (mutators & accessors) • SetName() & GetName() (2 pts) o SetPrice() & GetPrice() (2 pts) o SetQuantity() & GetQuantity0) (2 pts) Ex: • Private data members o string itemName - Initialized in default constructor to "none" o int itemPrice - Initialized in default constructor to 0 oint itemQuantity - Initialized in default constructor to 0 (2) In main(), prompt the user for two items and create two objects of the Item ToPurchase class. Before prompting for the second item, call cin.ignore() to allow the user to input a new string. (2 pts)
Ex: 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 (3) Add the costs of the two items together and output the total cost. (2 pts) Ex: TOTAL COST Chocolate Chips 1 @ $3 = $3 Bottled Water 10 @ $1 = $10 Total: $13