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 2
In this problem, you will reuse the InventoryItem class you created in Problem 1 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 load_inventory() 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 save_inventory()function, open a binary file named inventory.dat and dump the inventory list that was passed as a parameter to the function.
In the display_category()function, display each InventoryItem object that is in that category, or display "No items." if there are no items in that category.
In the display_inventory()function, 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 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!