diff --git a/Pizzeria_oop b/Pizzeria_oop new file mode 100644 index 0000000..f43c13e --- /dev/null +++ b/Pizzeria_oop @@ -0,0 +1,94 @@ +class Pizza: + + SMALL = 25 + MEDIUM = 30 + LARGE = 40 + PEPPERONI = "Pepperoni type" + MARGARITA = "Margarita type" + COOKING = 0 + READY = 1 + + def __init__(self, ingredients, size): + self.ingredients = ingredients + self.size = size + self.ready = Pizza.COOKING + + def cook(self): + print('Pizza is being cooked...') + self.ready = Pizza.READY + print('Pizza is ready!') + + +class Pepperoni(Pizza): + + pepperoni_ings = ['Salami', 'Cheese'] + + def __init__(self, size): + super().__init__(Pepperoni.pepperoni_ings, size) + + +class Margarita(Pizza): + + margarita_ings = ['Tomato', 'Cheese'] + + def __init__(self, size): + super().__init__(Margarita.margarita_ings, size) + + +class Worker: + + def __init__(self): + self.order = None + self.__cash = 0 + + @staticmethod + def greet_client(name): + print(f"Welcome, {name}!") + + def get_order(self, pizza_type, pizza_size): + if pizza_type == Pizza.PEPPERONI: + self.order = Pepperoni(pizza_size) + elif pizza_type == Pizza.MARGARITA: + self. order = Margarita(pizza_size) + + def get_money(self, money): + self.__cash += money + + def process_order(self): + self.order.cook() + return self.order + + +class Client: + default_name = 'Alex' + + def __init__(self, money, name=default_name): + self.__money = money + self.name = name + self.pizza = None + + @staticmethod + def choose_margarita_pizza(): + return Pizza.MARGARITA + + @staticmethod + def choose_pepperoni_pizza(): + return Pizza.PEPPERONI + + @staticmethod + def choose_small_size(): + return Pizza.SMALL + + @staticmethod + def choose_medium_size(): + return Pizza.MEDIUM + + @staticmethod + def choose_large_size(): + return Pizza.LARGE + + def pay_money(self, money): + self.__money -= money + + def get_pizza(self, pizza): + self.pizza = pizza