Question: In C++ using Visual Studio: Write a menu-driven program that will (1) create, update and display inventory data using an Inventory class, (2) create a
In C++ using Visual Studio:
Write a menu-driven program that will
(1) create, update and display inventory data using an Inventory class,
(2) create a binary Transaction file,
(3) apply the transactions against the inventory, and
(4) calculate a profit projection for inventory items.
Requirements
Create file InventoryClass.h which defines InventoryClass that has the following members:
A member variable for the item id (an integer)
A member variable for up to a 50 character the item description
A member variable for holding the quantity of items on hand
A constructor and the appropriate set and get functions
A print function that displays the item id, description, and quantity on hand
Feel free to add any additional member functions you might need.
Create file InventoryCostClass.h which defines InventoryCostClass that is derived from InventoryClass. The InventoryCostClass should have the following members:
A member variable for wholesale cost (a double)
A member variable for retail price (a double)
A member variable for the inventory update date in the format mm/dd/yyyy
A constructor and the appropriate set and get functions
A print function that overrides the print function in the base class. The InventoryCostClasss print function should invoke the InventoryClasss print function and then display the wholesale cost, retail price, and inventory update date
Feel free to add any additional member functions you might need.
In the main function, the program will repeatedly display a menu containing several options:
Store the Inventory: In main, create a size 50 array (using dynamic allocation) of Inventory objects. In a function, have the user enter the inventory data. Validate the data as follows: the item ID is 6 digits, each cost and price is greater than zero, and wholesale cost is less than retail price.
Create Transactions: in the second function, create a binary Transaction file containing multiple sets of 3 elements:
-item ID-6 digits
-transaction code (AI-add to inventory; RI-reduce from inventory; CW-change wholesale cost; CR-change retail price; CD-change item description)
-transaction data (for AI and RI-integers; for CW and CR-double; for CD-up to 50 characters)
Have the user enter the binary file name (of your choosing) in main, but open the binary file in the second function. Also have the user enter the data for the binary file in the function. Validate the transaction data as described above.
Update Inventory: in a function, match the transactions in the binary file to the array of Inventory objects and update the array of objects (remember to update the date field with today's date if the quantity is changed).
Display Inventory: in a function, display the updated Inventory data.
Compute a Profit Projection: in a function, have the user enter the item id for a which profit projection is desired. Compute the profit projection using the formula ((retail price * quantity on hand) (wholesale cost * quantity on hand)). Display the Item ID, item description, profit projection.
End Program.
Your menu items might be as follows:
Option 1 (Display Original Inventory) Insure that the original inventory only is displayed.
Option 2 (Create Transaction File) Display an appropriate completion message.
Option 3 (Update Inventory) Display an appropriate completion message.
Option 4 (Display Updated Inventory) Insure that the updated inventory only is displayed.
Option 5 (Compute Profit Projection) What to display is listed above.
Option 6 (End Program)
Use the data below to test the program.
The inventory data to enter is (enter in this order):
209875, Global-Designed Wrench: catalog 145HN-89, 1056, $14.67, $23.99, 10/13/2017
176524, Steeheel Chainsaw-120 H-P: catalog 133NM-65, 2654, $234.67, $299.99, 10/13/2017
340965, Plurers Pliers with Sure-Grip: catalog 764TW-12, 1043, $11.45, $19.98, 10/13/2017
453285, Rapid Recoil Hand Tape Measure: catalog 127UY-32, 3316, $8.56, $15.99, 10/13/2017
893167, Steady Built Steel Saw Horses: catalog 564HG-34, 764, $45.54, $79.99, 10/13/2017
597895, Big Boy Bib Overalls-L-XL-XXL: catalog 278LG-45, 5032, $19.76, $39.99, 10/13/2017
The binary Transaction file data is (enter in this order):
340965, AI, 57
209875, CR, $25.99
893167, RI, 64
597895, CW, $37.99
209875, CD, Global-Designed Wrench: catalog 200HN-90
Grading:
| Criteria | Range Low End (Did not do or did very little effort) | Range High End (Used correctly and spent time/effort on programming) |
| Names of variables are meaningful and the program comments self-document the program. | 0 | 5 |
| Program documentation includes instructions on how to use the program | 0 | 5 |
| Math operations (for max points use built-in math functions) NOTE: Increment does not count as a math operation. | 0 | 5 |
| Class type in a separate .h file with member functions (accessor functions, get, set, show, display find, etc.) For full points, include an overloaded function | 0 | 20 |
| Base/Derived classes or a template | 0 | 10 |
| Binary file | 0 | 5 |
| User instructions are clear | 0 | 10 |
| Program design is logical and well-organized | 0 | 10 |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
