Advertisement
Guest User

Pizza Order - order.py

a guest
Nov 18th, 2018
325
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.41 KB | None | 0 0
  1. class Order:
  2.     """This class is used to obtain an order for a pizza
  3.         from a customer it starts with a size"""
  4.  
  5.     def size(self):
  6.         self.size = str(input("Please enter the size of your pizza: small, medium or large: "))
  7.         if self.size == "small":
  8.             self.size = "small"
  9.         elif self.size == "medium":
  10.             self.size = "medium"
  11.         elif self.size == "large":
  12.             self.size = "large"
  13.         else:
  14.             self.size = "small"
  15.         return self.size
  16.  
  17.     def crust(self):
  18.         self.type = int(input("Enter 1 for regular crust and 2 for thin crust: "))
  19.         if self.type == 1:
  20.             self.new_crust = "regular crust"
  21.         elif self.type == 2:
  22.             self.new_crust = "thin crust"
  23.         return self.new_crust
  24.  
  25.     def cheese(self):
  26.         self.ans = input("Would you like cheese?(y/n): ")
  27.         if self.ans == 'y':
  28.             self.type = input("Enter 1 for cheddar, 2 for mozzarella, 3 for provolone, 4 for romano: ")
  29.             if self.type == 1:
  30.                 self.cheese = "cheddar"
  31.             elif self.type == 2:
  32.                 self.cheese = "mozzarella"
  33.             elif self.type == 3:
  34.                 self.cheese = "provolone"
  35.             elif self.type == 4:
  36.                 self.cheese = "romano"
  37.         else:
  38.             self.cheese = "no cheese"
  39.         return self.cheese
  40.  
  41.     def peppers(self):
  42.         if self.ans == 'y':
  43.             self.type = input("Enter 1 for bell peppers, 2 for jalapeno, 3 for habanero: ")
  44.             if self.type == 1:
  45.                 self.peppers = "bell peppers"
  46.             elif self.type == 2:
  47.                 self.peppers = "jalapeno"
  48.             elif self.type == 3:
  49.                 self.peppers = "habanero"
  50.         else:
  51.             self.peppers = "no peppers"
  52.         return self.peppers
  53.  
  54.     def bacon(self):
  55.         if self.ans == 'y':
  56.             self.type = input("Enter 1 for canadian bacon, 2 for side bacon: ")
  57.             if self.type == 1:
  58.                 self.bacon = "canadian bacon"
  59.             elif self.type == 2:
  60.                 self.bacon = "side bacon"
  61.         else:
  62.             self.bacon = "no bacon"
  63.         return self.bacon
  64.  
  65.     def output(self, toppings):
  66.         print("Thank You.", "Your order is as follows:")
  67.         print("You ordered a ", toppings[0], toppings[1], " pizza.")
  68.         print("Toppings: ", toppings[2], toppings[3], " and ", toppings[4],".")
  69.         print("Thank you for choosing MR. BIGGS PIZZA PLACE")
  70.         print("Your order is on its way.")
  71.  
  72.     def run(self):
  73.         #print(len(self.pizza))
  74.         self.new_size = self.size()
  75.         self.new_crust = self.crust()
  76.         self.new_cheese = self.cheese()
  77.         self.new_peppers = self.peppers()
  78.         self.new_bacon = self.bacon()
  79.         self.pizza = [self.new_size, self.new_crust, self.new_cheese, self.new_peppers, self.new_bacon]
  80.         self.output(self.pizza)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement