Question: Given main ( ) and Product.h , define the Product class ( in Product.cpp ) that will manage product inventory. Product class has four private
Given main and Product.h define the Product class in Product.cpp that will manage product inventory. Product class has four private data members: the product's name string a product code string the product's price double and the number count of product in inventory int
Implement the following Constructor and member functions listed in the Product.h file:
Productstring name, string code, double price, int count set the data members using the four parameters
void SetNamestring name set the product name to parameter name
string GetName return the product name
void SetCodestring code set the product code ie SKU to parameter code
string GetCode return the product code
void SetPricedouble p set the price to parameter p
double GetPrice return the price
void SetCountint num set the number of items in inventory to parameter num
int GetCount return the count
void AddInventoryint amt increase inventory by parameter amt
void SellInventoryint amt decrease inventory by parameter amt
Output each floatingpoint value with two digits after the decimal point, which can be achieved by executing
cout fixed setprecision; once before all other cout statements.
Ex If a new Product object "Apple" is created with code set to "SKU price set to and the count set to the output is:
Name: Apple Code: SKU Price: Count:
Ex If apples are added to the Product object's inventory, but then are sold, the output is:
Name: Apple Code: SKU Price: Count:
Ex If the Product "Golden Delicious" object's code is set to "SKU price is set to and count is set to the output is:
Name: Golden Delicious Code: SKU Price: Count:
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
