Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C++ Design an Inventory class that can hold information for an item in a retail store's inven- tory. The class should have the following private
C++ Design an Inventory class that can hold information for an item in a retail store's inven- tory. The class should have the following private member variables. Variable Name itemNumber quantity cost totalCost Description An int that holds the item's number An int that holds the quantity of the item onhand. A double that holds the wholesale per-unit cost of the item A double that holds the total inventory cost of the item (calculated as quantity times cost) The class should have the following public member functions Member Function default constructor constructor #2 Description Sets all the member variables to 0. Accepts an item's number, quantiry, and cost as arguments. The function should call other class functions to copy these values to the appropriate member variables and then call the setTotalcost Accepts an int argument that is copied to the itentunber member variable setItenNumber setQuantity Accepts an int argument that is copied to the quantity member Accepts a double argument that is copied to the cost member variable Calculates the total inventory cost for the item (quant ity times cost) and stores the result in totalCost Returns the value in itenNunber. Returns the value in quantity Returns the value in cost. Returns the value in totalcost. setCost setTotalcost getQuantity getCost get TotalCost Demonstrate the class by writing a simple program that uses it. Input Validation: Do not accept negative values for item mumber, quantity, or cost
C++
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started