Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
All Clients are served :P solution in Clear category for 3 Chefs by Stensen
from abc import ABCMeta
from dataclasses import dataclass
class AbstractCook(metaclass=ABCMeta):
food, drink = '', ''
food_amount, food_price = 0, 0
drink_amount, drink_price = 0, 0
def add_food(self, food_amount, food_price):
self.food_amount += food_amount
self.food_price += food_amount * food_price
def add_drink(self, drink_amount, drink_price):
self.drink_amount += drink_amount
self.drink_price += drink_amount * drink_price
@property
def total_price(self):
return self.food_price + self.drink_price
def total(self):
return f'{self.food}: {self.food_price}, {self.drink}: {self.drink_price}, Total: {self.total_price}'
@dataclass
class JapaneseCook(AbstractCook):
food = 'Sushi'
drink = 'Tea'
@dataclass
class RussianCook(AbstractCook):
food = 'Dumplings'
drink = 'Compote'
@dataclass
class ItalianCook(AbstractCook):
food = 'Pizza'
drink = 'Juice'
Oct. 10, 2020