Design an inventory class that can hold information for an item in a retail stores inventory. the
Question:
Design an inventory class that can hold information for an item in a retail stores inventory. the class should have the following private member variables.
variable name
itemNumber--an int that holds the items number
quantity-- an int that holds the quantity of the item on hand
cost-- a double that holds the wholesale per-unit cost of the item
the class should have the following public member functions
member function
default constructor- sets all the member variables to 0.
constructor #2- accepts an items number, quantity, and cost arguments. calls other class functions to copy these values into the appropriate member variables. then calls the setTotalCost function.
setItemNumber-- accepts an int argument and copies it into the itemNumber member variable
setQuantity- accepts an int argument and copies it into the quantity member variable
setCost-- accepts a double argument and copies it into the cost member variable
getItemNumber--returns the value in ItemNumber
getQuantity- returns the value in quantity
getCost-- returns the value in cost
getTotalCost-- computes and returns the totalCost
Demonstrate the class by writing a simple program that uses it. the program should validate the user inputs to ensure that negative values are not accepted for item number, quantity, or cost.
Statistics for Business Decision Making and Analysis
ISBN: 978-0321890269
2nd edition
Authors: Robert Stine, Dean Foster