Files
2026-07-30 11:35:10 +05:00

51 lines
1.6 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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} рублей.')