asked 32.0k views
3 votes
Write a python program with full pseudocode that will calculate a XX% tip and 6% tax on a meal price. The user will enter the meal price and the program will calculate tip, tax, and the total. The total is the meal price plus the tip plus the tax. Your program will then display the values of tip, tax, and total.The restaurant wants to change the program so that the tip percent is based on the meal price. The new amounts are as follows: Meal Price RangeTip Percent.01 to 5.9910%6 to 12.0013%12.01 to 17.0016%17.01 to 25.0019%25.01 and more22%

asked
User Bromanko
by
8.3k points

1 Answer

7 votes

Answer:

PSEUDO CODE:

1. Declare variables "meal_price","tax_perc", "tip" ,"tax" and "tot_bill".

1.1 Ask user to give value of "meal_price".

1.2 Initialize "tax_perc =0.06" that is 6%.

1.3 initialize "tip=0" and "tot_bill=0".

2. calculate tax on bill "tax=meal_price*tax_perc" .

3. If meal_price >=0.01 and meal_price<=5.99,

3.1 tip=(meal_price*0.1).

3.2 tot_bill=(meal_price+tax+tip)

4. else If meal_price >=6 and meal_price<=12,

4.1 tip=(meal_price*0.13).

4.2 tot_bill=(meal_price+tax+tip)

5. else If meal_price >=12.01 and meal_price<=17,

5.1 tip=(meal_price*0.16).

5.2 tot_bill=(meal_price+tax+tip)

6. else If meal_price >=17.01 and meal_price<=25,

6.1 tip=(meal_price*0.19).

6.2 tot_bill=(meal_price+tax+tip)

7. else If meal_price >=25.01 ,

7.1 tip=(meal_price*0.22).

7.2 tot_bill=(meal_price+tax+tip)

8.1 print the tip on bill

8.2 print the tax on bill

8.3 print the total bill

9. End the program.

#here is code in python

m_price=float(input('Enter the price of meal: '))

#declare and initialize variables

tot_bill=0

tip=0

tax=0

#calculate tax on basis of meal price

if m_price >=0.01 and m_price <= 5.99:

tip=m_price*(0.1)

elif m_price >= 6 and m_price <= 12.00:

tip=m_price*(0.13)

elif m_price >= 12.01 and m_price <= 17.00:

tip=m_price*(0.16)

elif m_price >= 17.01 and m_price <= 25.00:

tip=m_price * (0.19)

elif m_price >= 25.01:

tip=m_price * (0.22)

# calculating the tax

tax=m_price* (0.06)

# calculating the total

total=m_price+tip+tax

# displaying tax,tip,total

print('The tip on bill is %.2f' % tip)

print('The tax on bill is %.2f' % tax)

print('Total bill of meal %.2f' % total)

Output:

Enter the price of meal: 12.5

The tip on bill is 2.00

The tax on bill is 0.75

Total bill of meal 15.25

answered
User Sweta
by
8.2k points