Write a program that computes the tax and tip on a restaurant bill for a patron a $88.67 meal charge. The tax should be 6.75 percent of the meal cost. The tip should be 20 percent of the total after adding the tax. Display the meal cost, tax amount, tip mount, and total bill on the screen.

Respuesta :

tanoli

Answer:

C++ code is writtern below with explanation in comments

Explanation:

#include <iostream>

using namespace std;

int main()

{

//declare all the required fields in double format

   double mealCost =88.67;

   double taxPercenatage=6.75;

   double tipPercentage=20;

// displaying the original Meal Cost

   cout<< "Meal Cost: "<<mealCost<<endl;

// get the total tax percentage from meal cost

   double totalTax= taxPercenatage /100 * mealCost;

// display the tax amount

   cout<< "Tax Amount: "<<totalTax<<endl;

// getting tip amount from meal cost and tax amount.

   double totalTip = tipPercentage/100 * (mealCost+totalTax);

//displaying tip amount

   cout<< "Tip Amount: "<<totalTip<<endl;

// now adding all three values and get total amount that customer

// has to pay

   double totalAmount = mealCost+totalTax+totalTip;

//Displaying total amount

   cout<< "Total Bill: "<<totalAmount<<endl;

   return 0;

}

Output

Meal Cost: 88.67

Tax Amount: 5.98523

Tip Amount: 18.931

Total Bill: 113.586