Question: Create an Inventory class with data members for stock number, quantity, and price, and overloaded data entry and output operators. The data entry operator function
Create an Inventory class with data members for stock number, quantity, and price, and overloaded data entry and output operators. The data entry operator function should throw:
An error message, if the stock number is negative or higher than 999
The quantity, if it is less than 0
The price, if it is over $100.00
Then perform the following tasks:
a. Write a main()function that instantiates an array of five Inventory objects, and accepts data for each. Display an appropriate error message for each exception situation. When an exception is detected, replace all data fields with zeroes. At the end of the program, display data fields for all five objects. Save the file as Inventory.cpp.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
