Computer Science, asked by Anonymous, 8 months ago

Write a program to generate a restaurant bill using Nested if –else for 3 items with sub choices and calculate the amount.

Answers

Answered by Equestriadash
9

choice = "Yes"

while choice == "Yes":

   print("1. Breakfast", "2. Lunch", "3. Dinner", sep = "\n")

   c = input("State the choice of your order: ")

   print()

   if c == "1":

       a = int(input("Enter your amount of order: "))

       if a > 500:

           print("You receive a discount of 15%.")

           ta = a - (a*0.15)

           print(ta, "is your payable amount.")

       else:

           print("You receive a discount of 5%.")

           ta = a - (a*0.05)

           print(ta, "is your payable amount.")

   elif c == "2":

       a = int(input("Enter your amount of order: "))

       if a > 500:

           print("You receive a discount of 15%.")

           ta = a - (a*0.15)

           print(ta, "is your payable amount.")

       else:

           print("You receive a discount of 5%.")

           ta = a - (a*0.05)

           print(ta, "is your payable amount.")

   elif c == "3":

       a = int(input("Enter your amount of order: "))

       if a > 500:

           print("You receive a discount of 15%.")

           ta = a - (a*0.15)

           print(ta, "is your payable amount.")

       else:

           print("You receive a discount of 5%.")

           ta = a - (a*0.05)

           print(ta, "is your payable amount.")

   print()

   choice = input("Next payment? [Yes/No]: ")

   print()

Answered by niishaa
5

Answer:

choice = "Yes"

while choice == "Yes":

   print("1. Breakfast", "2. Lunch", "3. Dinner", sep = "\n")

   c = input("State the choice of your order: ")

   print()

   if c == "1":

       a = int(input("Enter your amount of order: "))

       if a > 500:

           print("You receive a discount of 15%.")

           ta = a - (a*0.15)

           print(ta, "is your payable amount.")

       else:

           print("You receive a discount of 5%.")

           ta = a - (a*0.05)

           print(ta, "is your payable amount.")

   elif c == "2":

       a = int(input("Enter your amount of order: "))

       if a > 500:

           print("You receive a discount of 15%.")

           ta = a - (a*0.15)

           print(ta, "is your payable amount.")

       else:

           print("You receive a discount of 5%.")

           ta = a - (a*0.05)

           print(ta, "is your payable amount.")

   elif c == "3":

       a = int(input("Enter your amount of order: "))

       if a > 500:

           print("You receive a discount of 15%.")

           ta = a - (a*0.15)

           print(ta, "is your payable amount.")

       else:

           print("You receive a discount of 5%.")

           ta = a - (a*0.05)

           print(ta, "is your payable amount.")

   print()

   choice = input("Next payment? [Yes/No]: ")

   print()

Similar questions