Write an algorithm for a program that can be used to determine the tip amount that should be added to a restaurant charge. Allow the user to input the total, before taxes and the tip percentage (15% or 20%). Produce output showing the calculated values including the total amount due for both the 15% and the 201% tips. Tax of 9% should be added to the bill before the tip is determined. Display subtotal showing the amount owed prior to applying the tip, show each tip amount and the totals with each tip amount. Be sure to provide labels for values and the totals with each tip amount. Write appropriate methods for your solution.
1. Print a message prompting to input a charge
2. Read charge
3. Set tax equal charge * 0.09
4. Set subtotal equal charge + tax
5. Print "Subtotal equals: " subtotal
6. Set tips15 equals subtotal*0.15
7. Set total15 equals subtotal + tips15
8. Print "15% tips will be: " tips15
9. Print "Total with 15% is " total15
10. Set tip20 equals subtotal*0.2
11. Set total20 equals subtotal + tips20
12. Print "20% tips will be: " tips20
13. Print "Total with 20% is " total20
Comments
Leave a comment