Feb-03-2019, 12:48 AM
I have created a python program that is an ordering system in a resturant. The resturant has scheme of if any customer buys 4 pizzas, gets 1 drink for free and if any customer buys 4 pastas, they get 1 free bruchetta. I created the program and it can calculate the total for each order and display it but where I am stuck is, now at the end of the program, I need to display how may orders were taken, how much is the total sales and how many free drink and bruchetta were given.
I really appreciate everyone's time and effort and your help. If my question is unclear, please let me know so that I can paste the full case scenario to give a full perspective. Thank you
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
#Pasta Prices pasta1 = 9.5 pasta2 = 17.00 pasta3 = 27.50 #Pizza Prices pizza1 = 10.99 pizza2 = 20.99 pizza3 = 29.99 def P(): pizza = int ( input ( "enter the number of pizzas for this order" )) if pizza = = 1 : pizza_sales = pizza1 elif pizza = = 2 : pizza_sales = pizza2 elif pizza = = 3 : pizza_sales = pizza3 elif pizza> 3 : quotient = pizza / / 3 remainder = pizza % 3 if remainder = = 1 : pizza_sales = ((quotient * pizza3) + pizza1) else : pizza_sales = ((quotient * pizza3) + pizza2) this_order = pizza return pizza_sales,this_order,remainder,quotient def PP(): pasta = int ( input ( "enther the number of pastas for this order" )) if pasta = = 1 : pasta_sales = pasta1 elif pasta = = 2 : pasta_sales = pasta2 elif pasta = = 3 : pasta_sales = pasta3 elif pasta> 3 : quotient1 = pasta / / 3 remainder1 = pasta % 3 if remainder1 = = 1 : pasta_sales = ((quotient1 * pasta3) + pasta1) else : pasta_sales = ((quotient1 * pasta3) + pasta2) this_order1 = pasta return pasta_sales,this_order1,quotient1,remainder1 def B(): pizza_sales,this_order,remainder,quotient = P() print ( "the total for" ,this_order, "pizzas is" ,pizza_sales) pasta_sales,this_order1,quotient1,remainder1 = PP() print ( "the total for" ,this_order1, "pastas is" ,pasta_sales) print ( "So the total is" ,(pizza_sales + pasta_sales)) order = 'm' while order = = 'm' or order = = 'M' : print ( "Please enter the order" ) \ \ a = input ( "Please enter P to order Pizza, T to order pasta or B to order both" ) if a = = 'P' or a = = 'p' : print ( "Current promotion: FREE drink for every 4 pizzas bought" ) pizza_sales,this_order,remainder,quotient = P() print ( "your total for" ,this_order, "pizza(s) is" ,pizza_sales) print ( "Free drinks given:" , quotient - 1 ) choice = input ( "Do you want to view the order summary for your last order?" ) if choice = = 'Y' or choice = = 'y' : print ( "Number of pizzas bought=" ,this_order) print ( "Grand total for the order=" ,pizza_sales) print ( "Free drinks given:" , quotient) elif a = = 'T' or a = = 't' : pasta_sales,this_order1,quotient1,remainder1 = PP() print ( "pasta sales for this order" ,pasta_sales, "and the number of pastas is" ,this_order1) print ( "Customer gets" , quotient1 - 1 , "free bruchetta" ) choice = input ( "Do you want to view the order summary for your last order?" ) if choice = = 'Y' or choice = = 'y' : print ( "Number of pastas bought=" ,this_order1) print ( "Grand total for the order=" ,pasta_sales) print ( "Customer gets" , quotient1 - 1 , "free bruchetta" ) elif a = = 'B' or a = = 'b' : B() else : print ( "invalid order code" ) order = input ( "Press M to take more order and press any other key to end your shift" ) |