31.5k views
1 vote
4. Restaurant Bill Wricc a program that computes the tax and tip on a restaurant bill for a patron with a $88.67 meal charge. The tax should be 6.75 percent of the meal cost. The rip should 82 Chapter 2 Introduction to C++ be 20 percent of the toral after adding the tax. Display che meal cost, tax amount, tip amount, and coral bill on the screen

1 Answer

2 votes

Answer:

The code is written in C++:

  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. double cost = 88.67;
  6. double tax = 88.67 * 0.0675;
  7. double tip = 0.2 * cost * tax;
  8. double total = cost + tax + tip;
  9. cout<< "The total bill is $" << total;
  10. return 0;
  11. }

Step-by-step explanation:

Firstly, let's declare and initialize the variable cost (Line 7). We just assign 88.67 cost value as given in the question.

Next, we declare variable tax, tip and total and apply the calculation formula to work out the value for each variable (Line 8-9).

At last, display the total to the console terminal (Line 12).

User Jdarling
by
3.3k points