In this exercise, you need to implement an inventory management system using stacks. The goal is to simulate real-world inventory operations, where products are managed in batches, and the Last-In-First-Out (LIFO) principle is applied. This approach mirrors scenarios where the most recently added inventory is used first, such as when dealing with durable goods.
Create the Inventory_Manager class (1 point) that manages the inventory for multiple products. Each object contains a dictionary of products where the product_name is used as key.
This class should have the following methods:
Product [product_name] already exists.
Product [product_name] not found
simulate_demand(min_demand, max_demand): generate a random demand for each product (1 point). The method returns a dictionary with as key product_name and value the demand wich corresponds to a random value between min_demand and max_demand. Standard min_demand equals 0 and max_demand 20.
simulate_day(demand): simulates a day of operations and returns the total holding cost and total stockout cost (2 points). The method parameter corresponds to the simulated demand as a dictionary (see method simulate_demand)
save_to_csv(filename): saves the inventory to a CSV file (1 point). Every row from the csv file corresponds to
[product_name],[batch_quantity],[batch_cost_per_unit]
load_from_csv(filename): Loads the inventory from the CSV file (2 points). In case the products is not already in the inventory, the product is added to the inventory.
print_inventory(): the methods prints the inventory for every project by reusing previous defined functions (1 point). For example:
Current Inventory: Product Widget: Batch(quantity=100, cost_per_unit=2.5) Batch(quantity=50, cost_per_unit=2.0) Product Gadget: Batch(quantity=70, cost_per_unit=3.0)
Add a main method that adds two products and for every product min 2 batches. Next print your inventory, simulate demand and save your inventory to a csv file.