C++ Shopping Cart Code Explanation and Example

preview_player
Показать описание

Question: Online Shopping Cart
Build the ItemToPurchase class with the following specifications:
Default constructor
Public class functions (mutators & accessors)
setName() & name()
setPrice() & price()
setQuantity() & quantity()
Private data members
string _name - Initialized in default constructor to "none"
int _price - Initialized in default constructor to 0
int _quantity - Initialized in default constructor to 0
(Step 2) Extend the ItemToPurchase class per the following specifications:
Parameterized constructor to assign item name, item description, item price, and item quantity (default values of 0).
Public member functions
setDescription() mutator & description() accessor
printItemCost() - Outputs the item name followed by the quantity, price, and subtotal
printItemDescription() - Outputs the item name and description
Private data members
string _description - Initialized in default constructor to "none"
Ex. of printItemCost() output:Bottled Water 10 @ $1 = $10Ex. of printItemDescription...

------------------------

Answered By:

Bradley L.
Bradley | Coding Tutor

------------------------

------------------------

About: Wyzant Ask an Expert offers free answers to your toughest academic and professional questions from over 65,000 verified experts. It’s trusted by millions of students each month with the majority of questions receiving an answer within 1 hour of being asked. If you ever need more than just an answer, Wyzant also offers personalized 1-on-1 sessions with experts that will work with you to help you understand whatever you’re trying to learn.

Рекомендации по теме