Commit a3b95bf5 authored by Raquel's avatar Raquel 💬


parent fd871f3d
class Dish:
def __init__(self,name, price, ingredients):
......@@ -15,70 +14,46 @@ class Dish:
profit= self.price - self.cost()
return profit
def __str__(self):
class Restaurant:
def __init__(self):
def order_dish(self,client,dish):
return self.order
def print_orders(self, client):
for order in self.order:
return f" Customer {client} \n Order # {self.order.index(order)} : {order[1]} - {order[1].price}"
def print_check(self,client):
# this code is just to assure the customer name will be printed only once
if len(list(zip(*self.order))[0]) > 0: #zip retrieves the first element accross a lists and returns a list with them
print(f" Customer {client} \n ")
for order in self.order:
if order[0] == client:
total += order[1].price
print( f" Order # {self.order.index(order)} : {order[1]} - {order[1].price}")
print(f" Total: {total}")
class Ingredients:
def __init__(self,name, cost):
cheese = Ingredients('Cheese', 5)
pepperoni = Ingredients('pepperoni', 5)
dough = Ingredients('dough', 5)
pizza = Dish("Pizza", 35, [cheese, pepperoni, dough])
salad = Dish("salad", 35, [cheese, pepperoni, dough])
restaurant= Restaurant()
restaurant.order_dish("Goofy", pizza)
restaurant.order_dish("Goofy", salad)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment