Problem

Design an Inventory class that can hold information for an item in a retail store’s inve...

Design an Inventory class that can hold information for an item in a retail store’s inventory.

The class should have the following private member variables.

The class should have the following public member functions.

Variable Name Description

itemNumber An int that holds the item’s 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

Member Function Description

default constructor Sets all the member variables to 0.

constructor #2 Accepts an item’s number, quantity, and cost as 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. This program should validate

the user inputs to ensure that negative values are not accepted for item number, quantity, or cost.

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT