Advertisement
Guest User

Untitled

a guest
Aug 21st, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.82 KB | None | 0 0
  1. """The program takes the order,
  2. prints the order list,
  3. calculates the bill:
  4. total net cost, tax, tip and the total amount to be paid
  5.  
  6. List TODO: add chceking if amount is int"""
  7.  
  8. def order():
  9. meal = 0
  10. order_list = []
  11. tax = 6.75 / 100
  12. tip = 15.0 / 100
  13. order_atvice = True
  14. while order_atvice == True:
  15. order_continue = str(input("Is the order active? Y/N: "))
  16. if order_continue.upper() == "N":
  17. print ("\n")
  18. for o in order_list:
  19. print (o)
  20. print ("\n")
  21. print("meal: %.2f $" % meal)
  22. tax_total = meal * tax
  23. print("tax: %.2f $" % tax_total)
  24. meal = meal + meal * tax
  25. tip_total = meal * tip
  26. print("tip: %.2f $" % tip_total)
  27. total = meal + meal * tip
  28. print("total: %.2f $" % total)
  29. order_active = False
  30. return
  31. elif order_continue.upper() == "Y":
  32. order = str(input("Add to order: \n1. Essperso 5$\n2. Cappuccino 7$\n3. Latte 10$\n4. Sacher Cake 15$ \n5. Cheesscake 10$\n6. Appelcake 12$\n"))
  33. amount = int(input("Amount of product: "))
  34. if order == "1":
  35. meal = meal + 5 * amount
  36. order_list.append("Essperso 5$ * %d" % amount)
  37. elif order =="2":
  38. meal = meal + 7 * amount
  39. order_list.append("Cappuccino 7$ * %d" % amount)
  40. elif order =="3":
  41. meal = meal + 10 * amount
  42. order_list.append("Latte 10$ * %d" % amount)
  43. elif order =="4":
  44. meal = meal + 15 * amount
  45. order_list.append("Sacher Cake 15$ * %d" % amount)
  46. elif order =="5":
  47. meal = meal + 10 * amount
  48. order_list.append("Cheesscake 10$ * %d" % amount)
  49. elif order =="6":
  50. meal = meal + 12 * amount
  51. order_list.append("Appelcake 12$ * %d" % amount)
  52. else:
  53. print ("Error. There is no such option")
  54. else:
  55. print ("Error. There is no such option")
  56.  
  57.  
  58. order()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement