Question: USE PYTHON3; DO NOT IMPORT ANY PACKAGES Please do both part 2 and part 3, I already finished part 1. Let me know ASAP if
USE PYTHON3; DO NOT IMPORT ANY PACKAGES
Please do both part 2 and part 3, I already finished part 1. Let me know ASAP if you need what I have in part 1 in order to solve the problem.
Part 2:


Part 3:

What the code looks like in the text editor:
class Warehouse: """ TODO: Complete the docstring. """
##### Part 2 ##### def __init__(self): """ TODO: Complete the docstring. """ # YOUR CODE GOES HERE # self.inventory = ... self.log = ...
def __str__(self): """ TODO: Complete the docstring. """ # YOUR CODE GOES HERE #
def get_product(self, product_id): """ TODO: Complete the docstring. """ # YOUR CODE GOES HERE #
def list_products(self): """ TODO: Complete the docstring. """ # YOUR CODE GOES HERE #
def remove_product(self, product_id): """ TODO: Complete the docstring. """ # YOUR CODE GOES HERE #
def import_product(self, product): """ TODO: Complete the docstring. """ # YOUR CODE GOES HERE #
def export_product(self, product_id): """ TODO: Complete the docstring. """ # YOUR CODE GOES HERE #
def size(self): """ TODO: Complete the docstring. """ # YOUR CODE GOES HERE #
def show_log(self): """ TODO: Complete the docstring. """ # YOUR CODE GOES HERE #
PART 3
class History: """ TODO: Complete the docstring. """
##### Part 3 ##### def __init__(self, product, user): """ TODO: Complete the docstring. """ self.product = ... self.user = ... self.id = ... self.time = datetime.now()
def __str__(self): """ TODO: Complete the docstring. """ # YOUR CODE GOES HERE #
def __repr__(self): """ TODO: Complete the docstring. """ # YOUR CODE GOES HERE #
Thank you so much!
Edit: Here is the product class:
class Product: """ TODO: Complete the docstring. """
##### Part 1.1 ##### def __init__(self, name, price): """ TODO: Complete the docstring. """ # YOUR CODE GOES HERE # self.name = name self.price = price Product.product_counter += 1 self.id = Product.product_counter
def __str__(self): """ TODO: Complete the docstring. """ return ( " " + self.name +" - " + str(self.price) + "$" )
def __repr__(self): """ TODO: Complete the docstring. """ return "PRODUCT "
class Limited_Product(Product): """ TODO: Complete the docstring. """
##### Part 1.2 ##### def __init__(self, name, price, amount): """ TODO: Complete the docstring. """ # YOUR CODE GOES HERE # super(name, price) self.amount = amount
def __str__(self): """ TODO: Complete the docstring. """ return ( " " + self.name + " - " + str(self.price) + "$ ("+ self.amount + ")" )
Edit2: Hi I don't know what you mean by question information. All the info is already given. Please clarify.
The Warehouse class provides abstraction to the warehouses, which stores all products for a particular store. In our system, a warehouse can supply multiple stores at the same time, but a store can only use one warehouse. You need to implement the following methods: 0 __init__(self) Initialize the following instance variables in the constructor: inventory The inventory of this warehouse. The keys are the (dict) product ids (int), and the values are the actual product instance (Product). Initialize it with an empty dictionary. log (list) The log that records all import, export and removal events occurred in this inventory (will be elaborated later). Initialize it with an empty list. _str_ (self) Return the string representation in this format: "Warehouse with {number of products stored} products" O get_product (self, product_id) Return the product instance with the given id (int) from the inventory. If the product is not found, return None instead. o list_products (self) Return a list of all actual product instances stored in the inventory. O remove_product (self, product_id) Remove the product instance with the given id (int) from the inventory. Return True if it's successfully removed, and return False if the product is already not in the inventory. It will also append the following message to the log if the product is successfully removed: "Product removed {time}" (there is two spaces after "removed" since the word is shorter) (Hint: use datetime.now() to obtain the current time.) Example: "Product
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
