Advertisement
Talithacelin

Food Order

Aug 21st, 2022 (edited)
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.61 KB | None | 0 0
  1. #thirdprogram 20 august , made this in a week or more?
  2. #edit 8/10: added a cashiering system
  3. #edit 29/10: added datetime
  4. import calendar
  5. import sys
  6. import datetime
  7. from datetime import datetime
  8.  
  9. today = datetime.today()
  10. dt = today.strftime("%d/%m/%Y")
  11. tm = today.strftime("%H:%M:%S")
  12. mefood = { "Pizza" : 4 , "Hamburger" : 2 , "Spaghetti" : 3 , "Fries" : 1}
  13.  
  14. while True:
  15.     print("----------------------")
  16.     print("Welcome to Talice Food")
  17.     print("----------------------")
  18.     name=str(input('Please enter your name : '))
  19.     intro=input ("Hello " + name + "!" " Are you ready to order? ")
  20.  
  21.     if intro == 'Yes' or intro == "yes":
  22.         print()
  23.         foods = ["---- MENU ----" ,"Pizza = $4", "Hamburger = $2", "Spaghetti = $3","Fries = $1"]
  24.         for food in foods:
  25.             print(food)
  26.  
  27.         pizza=int(input("How many pizzas? "))
  28.         if pizza < 1 :
  29.             print(f"Owkayy then..")
  30.         elif pizza >= 1 :
  31.             print(f"Great! Next:")
  32.  
  33.         hamburger=int(input("How many burgers? "))
  34.         if hamburger < 1 :
  35.             print(f"Owkayy then..")
  36.         elif hamburger >= 1 :
  37.             print(f"Great! Next:")
  38.  
  39.         spaghetti=int(input("How many spaghetti's? "))
  40.         if spaghetti < 1 :
  41.             print(f"Owkayy then..")
  42.         elif spaghetti >= 1 :
  43.             print(f"Great! Next:")
  44.  
  45.         fries=int(input("How many box of fries? "))
  46.         if fries < 1 :
  47.             print(f"Owkayy then..")
  48.         elif fries >= 1 :
  49.             print(f"YUM! Calculating total price...")
  50.    
  51.         cost = pizza *mefood["Pizza"] + hamburger*mefood["Hamburger"] + spaghetti*mefood["Spaghetti"] + fries*mefood["Fries"]
  52.         print()
  53.         print(f"The price will be ${cost:0.2f}")
  54.         print()
  55.  
  56.         while True:
  57.             pay = int(input("Enter the amount of money: $"))
  58.  
  59.             if pay < cost :
  60.                 print("Oops. Not enough. Please reenter amount.")
  61.                 print()
  62.                 continue
  63.  
  64.             elif pay == cost:
  65.                 print(f"Exact amount of ${cost} received. Thanks !")
  66.                 change = 0
  67.                 break
  68.  
  69.             else:
  70.                 change = pay - cost
  71.                 print(f"${pay} received. Here's your change!")
  72.                 print(f"Output: ${change}. Thanks!")
  73.                 break
  74.    
  75.         print()
  76.         sheet=input("Would you like to print a receipt? ")
  77.         if sheet == "Yes" or sheet == "yes":
  78.             orderan = {f"{pizza} pizza(s) x $4" , f"{hamburger} hamburger(s) x $2" , f"{spaghetti} spaghetti(s) x $3" , f"{fries} box of fries x $1" }
  79.             print()
  80.             print("-------------")
  81.             print("YOUR RECEIPT | Talice Food")
  82.             print("Order Date: " + dt )
  83.             print("Order Time: " + tm )
  84.             print("Customer Name: " + name)
  85.             print("-------------")
  86.             for sheets in orderan:
  87.                 print(sheets)
  88.             print("-------------")
  89.             print(f"TOTAL COST = ${cost:0.2f}")
  90.             print(f"Amount received = ${pay:0.2f}")
  91.             print(f"Change = ${change:0.2f}")
  92.             print("Thank you for your purchase! See you soon!")
  93.             print("-------------")
  94.         else:
  95.             print("Okay then! Thanks for the purchase!")
  96.  
  97.         print()
  98.         neworder= input("Would you like to do another purchase?")
  99.         if neworder == "Yes" or neworder == "yes":
  100.             continue
  101.         else :
  102.             print("Come back soon! Byee")
  103.             sys.exit(0)
  104.     else :
  105.         print("Please reenter your name and type yes!! :> " )
  106.         print()
  107.        
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement