Update** i have give up on completing this project cant make any funtions work correctly.. i will try it again some time soon

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 avaliable from " + str(self.start_time) + '-'+str(self.end_time)
  
  def calculate_bill(self, purchase_items):
    bill = 0
    for purchase_item in purchase_items:
      if purchase_item in self.items:
        bill += self.items[purchase_item]
        return bill
      


#Brunch Menu
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, 1100, 1600)


#Early_bird Menu
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,
}
early_bird_menu = Menu ("Early_bird",early_bird_items, 1500, 1800 )
#print(early_bird_menu.calculate_bill(['duck ragu', 'salumeria plate']))
dinner_list = {
  '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 = Menu("Dinner", dinner_list,1700, 2300 )

kids_items = {
  'chicken nuggets': 6.50, 'fusilli with wild mushrooms': 12.00, 'apple juice': 3.00
}
kids_menu = Menu("Kids", kids_items, 1100, 2100)

class Franchise:
  def __init__(self, address, menus):
    self.address = address
    self.menus = menus
  def __repr__(self):
    return self.address

menus =[brunch_menu, early_bird_menu, dinner_menu, kids_menu]
flagship_store = Franchise('1232 West End Road', menus)
new_installment = Franchise('12 East Mulberry Street', menus) 
#print(flagship_store)

def  available_menus(self, time):
  avaliable_menus =[]
  for menu in self.menus:
    if time >= menu.start_time and time <= menu.end_time:
      avaliable_menus.append(menu)
    return avaliable_menus
  print(flagship_store.avaliable_menus(2000))

Please post Python code, which includes indentations. To do so, use the </> icon that appears in the middle of the menu bar that appears at the top of the text box you are typing in.

capture

I’m a newbie looks like i can’t get anything right… but thanks i will create a new post.

1 Like

It looks much better! :slightly_smiling_face: (The available_menus() method should be indented to match the other methods, and the new franchises should come after the class definition, not in the middle of it. )

Are you still interested in working it through?

1 Like

Thank you!!! but i just started a new project… what would you recommend me try to do a different projector or work on the one that overheated my brain. i honestly don’t know how go about i.

If you find the new one interesting, go ahead and complete it. Don’t hesitate to use the forum. (If you do so, in addition to using the code box, don’t forget to post a link to your project.)

And you can come back to this one at any time!

1 Like