Question: Problem 2 In this problem, you will reuse the InventoryItem class you created in Problem 1 to create an inventory collecting program. You have been
Problem
In this problem, you will reuse the InventoryItem class you created in Problem to create an inventory collecting program.
You have been given a starter file which needs to be updated. With your updates, you will have a program that can collect inventory information and save it to a binary file. That file is loaded when the program starts if the file is present.
The program has TODO comments which indicate where you need to make changes:
In the main function, there is a while loop in which the program asks for inventory item data from the user and stores those items in a list. Implement the part which creates the InventoryItem object, asks the user for input, and then appends the object to the inventory list.
In the loadinventory function, attempt to open a binary file named "inventory.dat".
o If the file exists, load it into the inventory list and return that list to the calling routine.
o If the file doesn't exist, just return an empty list ot the calling routine.
In the saveinventoryfunction open a binary file named inventory.dat and dump the inventory list that was passed as a parameter to the function.
In the displaycategoryfunction display each InventoryItem object that is in that category, or display No items." if there are no items in that category.
In the displayinventoryfunction display each InventoryItem object that is in the list, or display "Inventory is empty." if the list is empty.
Once all the TODO sections are completed, the program should be able to maintain the list of inventory items between executions of the program.
Sample Output First run
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
