Question: C + + turn iinto Codes Modify assignment 1 3 - 6 ( Inventory Class ) to read in information from a file ( Inventory

C++ turn iinto Codes
Modify assignment 13-6(Inventory Class) to read in information from a file (Inventory.txt) to create Inventory objects that are, then, stored in an Inventory array of another object named dept (for department).Then, print each of the objects that comprise the departments inventory.
>>> Prefix all new fields and functions with your initials (e.g. fk_newfield)<<<
Modifications should be made to the Inventory class as follows:
1. Add a string variable named description to the class.
a. Add supporting mutator and accessor functions.
2. Add a function named print to the class to print the following (bolded letters are
variable names):
itemNumber description (tab) quantity on hand at a cost of cost, for a total cost of
totalCost.
Create a new class named Dept with the following attributes and methods:
1. Define an Inventory array named products to hold the inventory objects.
2. Define an integer named invItems to hold the total number of different inventory items.
3. Define an integer named invCount to hold the total number of actual inventory items.
4. Define a double named invCost to hold the total cost of all inventory items.
5. Feel free to define any work fields that you choose.
6. Define the following functions:
a. Constructor
i. accepts the max number of items to support
ii. dynamically allocates space for the products array
iii. no default constructor offered
b. addItem accepts the fields needed to create an inventory object and adds the object to the furniture array.
c. getinvItems that calculates and returns the number of different inventory items.
d. getinvCount that calculates and returns the total number of actual inventory
items.
e. getinvCost that calculates and returns the total cost of all inventory items.
f. printInv to print the items in the furniture array.
Modifications should be made to the main program as follows:
1. Define a constant in the main program named MAXITEMS and set it to 25.
2. Define a Dept object named furniture and use MAXITEMS to provide the maximum
inventory items it should allow.
3. Loop through the input file Inventory.txt and use the data in it to initialize as many items in the furniture object as the data allows.
The format of data in Inventory.txt is itemNumber, quantity, cost, description as
follows:
21224034.95 Designer_Jeans
12583020.99 Lamp
26871219.34 Table
35582187.52 Bookcase
413613102.95 Chair
55629144.95 Recliner
63415215.99 Sofa
74122267.82 NightStand
8520-3415.99 Blankets
935417499.00 Television
4. Call the print function of furniture to print the inventory list.
5. Print the furniture inventory item count, total inventory count, and total cost.
a. Provide a descriptive printout.
6. Issue a final Program ending. message at the end of the program.

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 Programming Questions!