Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #thirdprogram 20 august , made this in a week or more?
- #edit 8/10: added a cashiering system
- #edit 29/10: added datetime
- import calendar
- import sys
- import datetime
- from datetime import datetime
- today = datetime.today()
- dt = today.strftime("%d/%m/%Y")
- tm = today.strftime("%H:%M:%S")
- mefood = { "Pizza" : 4 , "Hamburger" : 2 , "Spaghetti" : 3 , "Fries" : 1}
- while True:
- print("----------------------")
- print("Welcome to Talice Food")
- print("----------------------")
- name=str(input('Please enter your name : '))
- intro=input ("Hello " + name + "!" " Are you ready to order? ")
- if intro == 'Yes' or intro == "yes":
- print()
- foods = ["---- MENU ----" ,"Pizza = $4", "Hamburger = $2", "Spaghetti = $3","Fries = $1"]
- for food in foods:
- print(food)
- pizza=int(input("How many pizzas? "))
- if pizza < 1 :
- print(f"Owkayy then..")
- elif pizza >= 1 :
- print(f"Great! Next:")
- hamburger=int(input("How many burgers? "))
- if hamburger < 1 :
- print(f"Owkayy then..")
- elif hamburger >= 1 :
- print(f"Great! Next:")
- spaghetti=int(input("How many spaghetti's? "))
- if spaghetti < 1 :
- print(f"Owkayy then..")
- elif spaghetti >= 1 :
- print(f"Great! Next:")
- fries=int(input("How many box of fries? "))
- if fries < 1 :
- print(f"Owkayy then..")
- elif fries >= 1 :
- print(f"YUM! Calculating total price...")
- cost = pizza *mefood["Pizza"] + hamburger*mefood["Hamburger"] + spaghetti*mefood["Spaghetti"] + fries*mefood["Fries"]
- print()
- print(f"The price will be ${cost:0.2f}")
- print()
- while True:
- pay = int(input("Enter the amount of money: $"))
- if pay < cost :
- print("Oops. Not enough. Please reenter amount.")
- print()
- continue
- elif pay == cost:
- print(f"Exact amount of ${cost} received. Thanks !")
- change = 0
- break
- else:
- change = pay - cost
- print(f"${pay} received. Here's your change!")
- print(f"Output: ${change}. Thanks!")
- break
- print()
- sheet=input("Would you like to print a receipt? ")
- if sheet == "Yes" or sheet == "yes":
- 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" }
- print()
- print("-------------")
- print("YOUR RECEIPT | Talice Food")
- print("Order Date: " + dt )
- print("Order Time: " + tm )
- print("Customer Name: " + name)
- print("-------------")
- for sheets in orderan:
- print(sheets)
- print("-------------")
- print(f"TOTAL COST = ${cost:0.2f}")
- print(f"Amount received = ${pay:0.2f}")
- print(f"Change = ${change:0.2f}")
- print("Thank you for your purchase! See you soon!")
- print("-------------")
- else:
- print("Okay then! Thanks for the purchase!")
- print()
- neworder= input("Would you like to do another purchase?")
- if neworder == "Yes" or neworder == "yes":
- continue
- else :
- print("Come back soon! Byee")
- sys.exit(0)
- else :
- print("Please reenter your name and type yes!! :> " )
- print()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement