Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 (stands for I/O manipulation) library.

Observations

For formatting your output you will need to use the functions fixed and setprecision(), available in the library.

- 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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

What Is A Database And How Do I Use It

Authors: Matt Anniss

1st Edition

1622750799, 978-1622750795

More Books

Students also viewed these Databases questions

Question

EXPLAIN the five steps in the performance management process.

Answered: 1 week ago

Question

=+country competitive advantages? Why? Support your point of view.

Answered: 1 week ago

Question

=+from: a) a MNEs perspective? and b) the HRM managers perspective?

Answered: 1 week ago