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.

Inventory

Implement the Batch class (1 point)

Create the Batch class that represents a batch of inventory for a product. Each Batch object should contain:

The class also contains a tostring method str that represent the batch as follow:

Batch(quantity=[quantity], cost_per_unit=[self.cost_per_unit])

Implement the Product class (6 points):

Create the Products class (1 point) that represents a product with a stack of inventory batches. Every Product object should contain:

This class should have the following methods:

The class also contains a tostring method str (1 point) that represent the product as follows:

Product [product_name]:
Batch(quantity=[quantity_batch1 from batch_1], cost_per_unit=[cost_per_unit from batch_1])
Batch(quantity=[quantity_batch1 from batch_2], cost_per_unit=[cost_per_unit from batch_2])
....
Batch(quantity=[quantity_batch1 from batch_n], cost_per_unit=[cost_per_unit from batch_n])