// Torrez, Elaine CS1A Chapter 2 P. 81, #4
/******************************************************************************************
*
* CALCULATE RESTAURANT BILL TOTAL
*
* --------------------------------------------------------------------------------
* This program calculates the tax and tip from the total cost of a restaurant bill.
* It then displays the meal cost, tax amount, tip amount, and total.
* --------------------------------------------------------------------------------
*
* INPUT
* mealCost : cost of the meal before tax and tip
* taxRate : 6.75%
* tipRate : 15%
*
* OUTPUT
* mealTax : 6.75% of the meal cost
* mealTip : 15% of the meal cost + tax
* total : meal cost + tax + tip
*
*******************************************************************************************/
#include <iostream>
#include <iomanip> // Included for fixed and setprecision
using namespace std;
int main()
{
double mealCost; // Cost of the meal
double mealTax; // Tax on the meal
double mealTip; // Tip on meal + tax
double total; // Total cost including tax and tip
mealCost = 44.50; // INPUT meal cost
mealTax = mealCost * 0.0675; // Compute tax
mealTip = (mealCost + mealTax) * 0.15; // Compute tip
total = mealCost + mealTax + mealTip; // Compute total
cout << fixed << setprecision(2);
// OUTPUT
cout << "Meal Cost : $" << mealCost << endl;
cout << "Tax (6.75%): $" << mealTax << endl;
cout << "Tip (15%) : $" << mealTip << endl;
cout << "Total Bill : $" << total << endl;
return 0;
}