Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 30th, 2012  |  syntax: Python  |  size: 1.85 KB  |  hits: 20  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. from __future__ import division #To stop 1//2 == 0 (From a friend)
  2. #Name: Hy Diep
  3. #Date: 4-27-12
  4.  
  5.  
  6. #This script will help you determine the cost of your order at Dr. Joe's Pizzeria.
  7.  
  8.  
  9. def main():
  10.    
  11.     while True:
  12.         #Pricing Variables
  13.         Peporoni= 5.55
  14.         Mushroom= 10.00
  15.         Sasuage= 30.00
  16.         Pineapple= 40.00
  17.         Tax= .15
  18.    
  19. #Pricing for pizza types.
  20.    
  21.         print ("Pepperoni is 5.55")
  22.         print ("Mushroom is 10.00")
  23.         print ("Sasuage is 30.00")
  24.         print ("Pineapple is 40.00")
  25.         print ("Tax per person is 15%")
  26.  
  27.         print
  28.    
  29.         numberPizzas = input("How many whole pizzas? ")
  30.         numberPeople = input("Number of People? ")
  31.         typePizza = input("Type of Pizza? ")
  32.         typeDiscountPercent = input("If avaliable, what is the discount percentage? (Number only) ")
  33.         typeDiscountDecimal = typeDiscountPercent / 100
  34.    
  35.         if typeDiscountPercent > 0:
  36.             Totaldiscount= str(((numberPizzas * typePizza) + (numberPeople * Tax)) * (1 - typeDiscountDecimal))
  37.        
  38.         if typeDiscountPercent < 0:
  39.             Total= str((numberPizzas * typePizza) + (numberPeople * Tax))
  40.  
  41.         if typeDiscountPercent > 100:
  42.             print "Error! Only numbers between 0 and 100!"            
  43.            
  44.         else:
  45.             if typeDiscountPercent > 0:
  46.                 print "Total Cost is " + (Totaldiscount)
  47.    
  48.         if typeDiscountPercent < -0:
  49.                print "Error! Only numbers between 0 and 100! Please try Again!"
  50.            
  51.         else:
  52.             if typeDiscountPercent < 0:
  53.                 print "Total Cost is " + (Total)
  54.  
  55.         reset = raw_input("Do you need to restart? Yes or No ")
  56.  
  57.         if reset is ("yes"):
  58.        
  59.             print
  60.        
  61.         if reset == ("No"):
  62.            break
  63.  
  64. main()