-
-
Save codecademydev/09fa898398173ff01be32cd352aa6426 to your computer and use it in GitHub Desktop.
Codecademy export
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Menu: | |
def __init__(self,name,items,start_time,end_time): | |
self.name = name | |
self.items = items | |
self.start_time = start_time | |
self.end_time = end_time | |
def __repr__(self): | |
return self.name + ' menu available from ' + str(self.start_time) + ' to ' + str(self.end_time) | |
def calculate_bill(self, purchased_items): | |
bill = int() | |
for item in purchased_items: | |
bill += self.items[item] | |
return bill | |
#menus = [brunch_menu, early_bird, kids, dinner] | |
class Franchise: | |
def __innit__(self, address, menus): | |
self.address = address | |
self.menus = menus | |
def __repr__(self): | |
return self.address | |
brunch_items = { | |
'pancakes': 7.50, 'waffles': 9.00, 'burger': 11.00, 'home fries': 4.50, 'coffee': 1.50, 'espresso': 3.00, 'tea': 1.00, 'mimosa': 10.50, 'orange juice': 3.50 | |
} | |
brunch_menu = Menu('brunch',brunch_items,start_time = 1100,end_time = 1600) | |
print(brunch_menu.start_time) | |
early_bird_items = { | |
'salumeria plate': 8.00, 'salad and breadsticks (serves 2, no refills)': 14.00, 'pizza with quattro formaggi': 9.00, 'duck ragu': 17.50, 'mushroom ravioli (vegan)': 13.50, 'coffee': 1.50, 'espresso': 3.00, | |
} | |
#print(brunch_menu.calculate_bill(['pancakes','home fries','coffee'])) | |
early_bird = Menu('Early-Bird',early_bird_items,1500,1800) | |
#print(early_bird.name) | |
dinner_items = { | |
'crostini with eggplant caponata': 13.00, 'ceaser salad': 16.00, 'pizza with quattro formaggi': 11.00, 'duck ragu': 19.50, 'mushroom ravioli (vegan)': 13.50, 'coffee': 2.00, 'espresso': 3.00, | |
} | |
dinner = Menu('Dinner', dinner_items, 1700, 2300) | |
#print(dinner.end_time) | |
kids_items = { | |
'chicken nuggets': 6.50, 'fusilli with wild mushrooms': 12.00, 'apple juice': 3.00 | |
} | |
kids = Menu('Kids', kids_items, 1100, 2100 ) | |
menus = [brunch_menu, early_bird, kids, dinner] | |
flagship_store = Franchise('1232 West End Road', menus) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment