Question
Write a C++ program that computes the tax and tip on a restaurant bill. The program should prompt the user to enter the cost of
Write a C++ program that computes the tax and tip on a restaurant bill. The program should prompt the user to enter the cost of a meal. The tax is computed at 6.75% of the meal cost. Tip is calculated as a percentage of the meal cost inclusive of the tax. Your program should compute the tip at 15%, 20% and 25% and then output the total amount on the bill for the three different tip amounts. To format the output of your program you will need to use the
Observations
For formatting your output you will need to use the functions fixed and setprecision(), available in the
- Work on the output formatting part at the end, once you know your program is producing the correct results.
- Give some thought into choosing the right data types for your variables.
- Use named constants where appropriate.
- Document your code. Add comments describing your algorithm. Add comments describing the purpose of the variables you use.
Sample of what your program should looked like Input/Output
Please enter meal cost: 100
The total bill with a 15% tip is $122.76
The total bill with a 20% tip is $128.10
The total bill with a 25% tip is $133.44
Please enter meal cost : 200.00
The total bill with a 15% tip is $245.52
The total bill with a 20% tip is $256.20
The total bill with a 25% tip is $266.88
- Note, the prompt Please enter meal cost: is not part of the input. The prompt is something your program should display on the screen. Also note there is no end-of-line at the end of the prompt.
- Note the blank line between the prompt and the output lines.
- Note the $ signs before the total bill amounts
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started