init
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
class Dish():
|
||||
def __init__(self, name, price):
|
||||
self.price = price
|
||||
self.name = name
|
||||
|
||||
def prepare():
|
||||
pass
|
||||
|
||||
class MainCource(Dish):
|
||||
def __init__(self, name, price, weight):
|
||||
super().__init__(name, price)
|
||||
self.weight = weight
|
||||
|
||||
def prepare(self):
|
||||
return f"Ваше блюдо {self.name} массой {self.weight} готовится!"
|
||||
|
||||
class Drink(Dish):
|
||||
def __init__(self, name, price, capacity):
|
||||
super().__init__(name, price)
|
||||
self.capacity = capacity
|
||||
|
||||
def prepare(self):
|
||||
return f"Ваш напиток {self.name} объемом {self.capacity} мл готовится!"
|
||||
|
||||
class Desert(Dish):
|
||||
def __init__(self, name, price, kkal):
|
||||
super().__init__(name, price)
|
||||
self.kkal = kkal
|
||||
|
||||
def prepare(self):
|
||||
return f"Ваш дессерт {self.name} каллорийностью {self.kkal} готовится!"
|
||||
|
||||
class Wallet():
|
||||
def __init__(self, vol):
|
||||
self.vol = vol
|
||||
|
||||
def __add__(self):
|
||||
add = input("На сколько едениц вы хотите пополнить кошелек?\n>> ")
|
||||
self.vol += add
|
||||
|
||||
class Order():
|
||||
def __init__(self, dish1, dish2, di):
|
||||
|
||||
print("### Добро пожаловать, Александр! Это ваша любимая шаурмечка. Что будете брать сегодня?####")
|
||||
print(f"У меня есть {wallet.vol} рублей.")
|
||||
|
||||
for dish in order:
|
||||
print(dish.prepare())
|
||||
wallet.vol = wallet.vol - dish.price
|
||||
|
||||
print(f'Вкусно поел! Осталось {wallet.vol} рублей.')
|
||||
Reference in New Issue
Block a user