Question: For C++ Chapter 7 Programming Challenge #7 - Inventory Class You should have a .h file for the class, a .cpp file for the class

For C++

Chapter 7

Programming Challenge

#7 - Inventory Class

You should have a .h file for the class, a .cpp file for the class and a .cpp file with your main in it.

Create a destructor function as part of your class definition. It should simply cout a message saying the object is being destroyed.

Note, the spec states for the 2nd constructor to call setTotalCost(). You don't need to do this or define that method.

privat memeber variables: int itemNumber, int quantity, double cost

public: default constructor that sets all the member variables to 0

constructor#2 accepts an items number, quantity, and cost as arugments. Calls other functions to copy these values into the appropriate member variables.

setItemNumber : acceps an int arugment and copies in to the itemNumber member variable

setQuantity: accepts an int arguement and copies in to the quantity member variable

setCost: acceps an double arguement and copies into the cost member variable.

getItemNumber: returns the value in itemNumber

getQuantity: returns the value in the 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 sohudl validate the user inputs to ensure that negative values are not accepted for item number, quantity, or cost.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!