Beispiel #1
0
class Program():
    """
    Creates a blueprint for a program
    """

    def __init__(self):
        """
        creates a new program
        """
        self.input = Input()
        self.output = Output()
        self.inventory = Inventory()
        self.choice = None

    def run(self):
        """
        runs the program
        """
        print("\nWelcome!")

        while self.choice != 4:
            # Prints the main menu
            print(self.output.get_main_menu())

            self.choice = self.input.get_choice_in_range(4)

            if self.choice == 1:

                new_product = self.inventory.create_product()
                self.input.set_product_properties(new_product)
                self.inventory.add_product(new_product)

            elif self.choice == 2:

                products = self.inventory.get_products()
                print(self.output.get_products_list(products))

            elif self.choice == 3:

                product_name = self.input.get_input_as_str("Enter product name: ")
                product = self.inventory.get_product(product_name)
                print(self.output.get_product_information(product))
Beispiel #2
0
def build_inventory(inventory: Inventory, products):
    for product in products:
        inventory.add_product(product)
Beispiel #3
0
    supplier.suppliers[0].name)
print(bcolors.ENDC + ' -------------------------------------------------- ')

supplier.add_supplier('Second Supplier', '09120002234')
print(
    bcolors.OKGREEN + bcolors.BOLD +
    ' [Suppliers] : Second Supplier Object is created\nSupplier Name is : ',
    supplier.suppliers[1].name)
print(bcolors.ENDC + ' -------------------------------------------------- ')

first_supplier = supplier.suppliers[0]
second_supplier = supplier.suppliers[1]

inventory = Inventory()

first_product = inventory.add_product('Tea', 80000, 2, None, 'consumable')
print(
    bcolors.OKGREEN + bcolors.BOLD +
    ' [Inventory] : First Product Object is created\nName is :', first_product)
print(bcolors.ENDC + ' -------------------------------------------------- ')

second_product = inventory.add_product('Coffee', 100000, 2, 120000,
                                       'consumable')
print(
    bcolors.OKGREEN + bcolors.BOLD +
    ' [Inventory] : Second Product Object is created\nName is :',
    second_product)
print(bcolors.ENDC + ' -------------------------------------------------- ')

third_product = inventory.add_product('Sugar', 10000, 4, None, 'consumable')
print(