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 Inventory Class to read in information from a file Inventorytxt to create Inventory objects that are, then, stored in an Inventory array of another object named dept for departmentThen, print each of the objects that comprise the departments inventory.
Prefix all new fields and functions with your initials eg fknewfield
Modifications should be made to the Inventory class as follows:
Add a string variable named description to the class.
a Add supporting mutator and accessor functions.
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:
Define an Inventory array named products to hold the inventory objects.
Define an integer named invItems to hold the total number of different inventory items.
Define an integer named invCount to hold the total number of actual inventory items.
Define a double named invCost to hold the total cost of all inventory items.
Feel free to define any work fields that you choose.
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:
Define a constant in the main program named MAXITEMS and set it to
Define a Dept object named furniture and use MAXITEMS to provide the maximum
inventory items it should allow.
Loop through the input file Inventorytxt 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:
DesignerJeans
Lamp
Table
Bookcase
Chair
Recliner
Sofa
NightStand
Blankets
Television
Call the print function of furniture to print the inventory list.
Print the furniture inventory item count, total inventory count, and total cost.
a Provide a descriptive printout.
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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
