Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Pizza Perfection
- import random # Imports the Random Module
- import time
- from Menu import *
- checkout = 0
- checkout_words = None
- #-=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=-
- def Register_Username():
- global username
- username = input("Before you start, you must register. Please enter a suitable username: ")
- print("Thank you.\n")
- Register_Password()
- #-=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=-
- def Register_Password():
- global password
- password = input("Please enter a password. It must be at least 8 characters long: ")
- while len(password) < 8:
- print("This password is too short.")
- Register_Password()
- print("Thank you. You have successfully registered and may now access the system.")
- Menu()
- #-=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=-
- def Login_Username():
- while True:
- try:
- if username == username:
- break
- except NameError:
- print("You have not successfully registered, please register before accessing the system.")
- Menu()
- attempted_username = input("\n\n\nPlease login by firstly entering your username: ")
- if attempted_username != username:
- print("The username entered does not match an account already registered, please try again.")
- Login_Username()
- else:
- Login_Password()
- #-=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=-
- def Login_Password():
- attempted_password = input("\n\nThis username matches a registered account. Please enter the password associated with this account: ")
- if attempted_password != password:
- print("The password entered does not match with the username entered, please try again.")
- Login_Password()
- else:
- print("You have successfully logged in. You are now being directed to the system.")
- PizzaPerfection()
- #-=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=-
- def PizzaPerfection():
- global checkout
- print(
- """
- +-----------|----------------------------------------|-----------+
- +-----------| Restaurant Menu: |-----------+
- +-----------| 1 - Pizzas |-----------+
- +-----------| 2 - Sides |-----------+
- +-----------| 3 - Desserts |-----------+
- +-----------| 4 - Reset Basket |-----------+
- +-----------| 5 - Complete Purchase |-----------+
- +-----------|----------------------------------------|-----------+
- """
- )
- print("Current checkout cost: £", checkout,)
- print("Current time is:" ,time.ctime())
- program = input("Please enter a number from the Menu: ")
- if program == "1":
- Pizza_Select()
- elif program == "2":
- Side_Select()
- elif program == "3":
- Dessert_Select()
- elif program == "4":
- Reset()
- elif program == "5":
- Final()
- else:
- print("That is not a valid option. Try again.")
- PizzaPerfection()
- #-=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=-
- def Pizza_Select():
- global checkout
- global Pizzas
- Pizzas()
- pizza_choice = input("We currently offer...\n• (1) Cheese Pizza\n• (2) Pepperoni Pizza\n• (3) Vegetable Pizza\n\nPlease enter the number of the pizza you would like, or type 4 to return: ")
- if pizza_choice == "1":
- print("1 Cheese Pizza added to your Basket.")
- checkout = checkout + cheese_pizza
- PizzaPerfection()
- elif pizza_choice == "2":
- print("1 Pepperoni Pizza added to your Basket.")
- checkout = checkout + pepperoni_pizza
- PizzaPerfection()
- elif pizza_choice == "3":
- print("1 Vegetable Pizza added to your Basket.")
- checkout = checkout + vegetable_pizza
- PizzaPerfection()
- elif pizza_choice == "4":
- PizzaPerfection()
- else:
- print("That is not a valid option. Try again.")
- Pizza_Select()
- #-=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=-
- def Side_Select():
- global checkout
- global Sides
- Sides()
- chips = 2
- onion_rings = 2
- side_choice = input("We currently offer...\n• (1) Chips\n• (2) Onion Rings\n\nPlease enter the number of the Side you would like, or type 3 to return: ")
- if side_choice == "1":
- print("1 Chips added to your Basket.")
- checkout = checkout + chips
- PizzaPerfection()
- elif side_choice == "2":
- print("1 Onion Rings added to your Basket.")
- checkout = checkout + onion_rings
- PizzaPerfection()
- elif side_choice == "3":
- PizzaPerfection()
- else:
- print("That is not a valid option. Try again.")
- Side_Select()
- #-=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=-
- def Dessert_Select():
- global checkout
- global Desserts
- dessert_choice = input("We currently offer...\n• (1) Chocolate Cookies\n• (2) Donuts\n• (3) Ice Cream\n\nPlease enter the number of the Dessert you would like, or type 4 to return: ")
- if dessert_choice == "1":
- print("1 Chocolate Cookies added to your Basket.")
- checkout = checkout + chocolate_cookies
- PizzaPerfection()
- elif dessert_choice == "2":
- print("1 Donuts added to your Basket.")
- checkout = checkout + donuts
- PizzaPerfection()
- elif dessert_choice == "3":
- print("1 Ice Cream added to your Basket.")
- checkout = checkout + ice_cream
- PizzaPerfection()
- elif dessert_choice == "4":
- PizzaPerfection()
- else:
- print("That is not a valid option. Try again.")
- Dessert_Select()
- #-=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=-
- def Reset():
- checkout = 0
- print("Basket reset.")
- PizzaPerfection()
- #-=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=-
- def Final():
- print("\n\nYour final cost was: £" ,checkout,)
- collection_time = time.time() + 1200
- print("Your order will be ready for collection at:" ,time.ctime(collection_time))
- input("Thanks for your order. Press ENTER to close the system.")
- quit()
- #-=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=-
- def Quit(): # Defining the Function "Quit".
- print("You are now quitting the program...") # Alerts the user that the program is now going to quit.
- print("Please press the ENTER key.") # Alerts the user on how to close the program completely.
- print("If you wish to cancel this, then call the Menu Function using Menu() after pressing 'Cancel' on Quit.") # Lets the user cancel the quit if they would like to.
- quit() # This will quit the program.
- #-=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=-
- def Menu():
- print(
- """
- +-----------|----------------------------------------|-----------+
- +-----------| Pizza Perfection: |-----------+
- +-----------| 1 - Register |-----------+
- +-----------| 2 - Start the system |-----------+
- +-----------| 3 - Quit |-----------+
- +-----------|----------------------------------------|-----------+
- """
- )
- program = input("Please enter a program number: ")
- if program == "1":
- Register_Username()
- elif program == "2":
- Login_Username()
- elif program == "3":
- Quit()
- elif program == "10":
- input("This is an administrator only function. Press ENTER to continue.")
- username = "admin"
- password = "admin"
- PizzaPerfection()
- else:
- print("This is not a valid program number.\nYou are now being returned to the Main Menu.")
- Menu()
- Menu()
- #-=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=-
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement