Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Simple to understand solution in Clear category for 3 Chefs by von.Oak
class AbstractCook:
def __init__(self):
self.food_total = 0
self.drink_total = 0
def add_food(self, food_amount, food_price):
self.food_total += food_amount * food_price
def add_drink(self, drink_amount, drink_price):
self.drink_total += drink_amount * drink_price
class JapaneseCook(AbstractCook):
def total(self):
return f'Sushi: {self.food_total}, Tea: {self.drink_total}, Total: {self.food_total + self.drink_total}'
class RussianCook(AbstractCook):
def total(self):
return f'Dumplings: {self.food_total}, Compote: {self.drink_total}, Total: {self.food_total + self.drink_total}'
class ItalianCook(AbstractCook):
def total(self):
return f'Pizza: {self.food_total}, Juice: {self.drink_total}, Total: {self.food_total + self.drink_total}'
July 7, 2018