import random
import math

class Pizzas:   #SC1
   min = 10
   max = 20
   def __init__(self, MenuCode, MenuName, PizzaCount):
      self.symbol = MenuCode
      self.name = MenuName
      self.count = PizzaCount
      self.price = math.floor(random.randint(self.min, self.max)) #SC2 
   
   def getValue(self): #SC3 
      temp = math.floor(self.price * self.count * 100)
      temp /= 100
      return temp
   
   def toString(self):  #SC4 #SC5 
      return "Menu Code: " + str(self.symbol) + "\nMenu Name: " + str(self.name) + "\nMenu Price: " + "$" + "{0:.2f}".format(self.price) + "\nTotal Pizza Count: " + str(self.count) + "\nTotal Inventory Cost: " + "$" + " {0:.2f}".format(self.getValue())+"\n"

########################
########################
#DRIVER SECTION
      
quantity = 0
pizzas = []
controlOuter = True 
controlInner = True 


while controlOuter:
   while controlInner:
      try:  #SC6
         quantity = input("How many simulated frozen pizza items do you want to create? You must enter between 1 and 10.\n")
         quantity = int(quantity)
         break      
      except ValueError:  #SC6  
         print("WARNING! You cannot enter in letters. Try again.\n")
   
   while controlInner: #SC7 
      if (quantity > 0 and quantity <= 10):
         controlOuter = False
         break 
      print("WARNING! Your entered too low or too high for the quantity. Try again please.\n")
      break

print("You entered: " + str(quantity))
print("\nYou will now create the menu item code for the inventory management system, \nname of the menu item and how much inventory for the pizza to keep in the freezer. " + "\nThe price will be randomly generated.\n")
i = 0
n = 1
while (i < quantity):
   while True: #SC8 
      print("\nPlease enter a three letter/number menu code for pizza number "+ str(n) + ": ") 
      tempMenuCode = str(input())
      if len(tempMenuCode) == 3:
         print("\nYou entered: "+tempMenuCode)
         break
      else:
         print("\nYou entered an incorrect value:")
   
   print("Please enter the pizza name:") #SC9 
   tempMenuName = str(input())

   while True:
      try: #SC10  
         print("Please enter total inventory count of this " + tempMenuName + " pizza to keep in the freezer:")
         tempPizzaCount = int(input())
         break
      except ValueError: #SC10 
         print("WARNING! You cannot enter in letters. Try again.\n")
  
   tempEntry = Pizzas(tempMenuCode, tempMenuName, tempPizzaCount) 
   pizzas.append(tempEntry) #SC11   
   i = i + 1
   n += 1
print("\nListed below is your current pizza inventory:")
for object in pizzas:   #SC12 
   print(object.toString())
