Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ Assignment Write a menu-driven program that will (1) create, update and display inventory data using an Inventory class, (2) create a binary Transaction file,

C++ Assignment

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.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases Organizing Information Digital And Information Literacy

Authors: Greg Roza

1st Edition

1448805929, 978-1448805921

More Books

Students also viewed these Databases questions