//Xinnuo Wang CS1A Chapter 2, P. 81, #4
//
/*******************************************************************************
*
* COMPUTE Restaurant Bill
* ______________________________________________________________________________
* This program computes the tax and tip on a restaurant bill for a patron with
* a $44.50 meal charge. The tax should be 6.75 percent of the meal cost. The tip
* should be 15 percent of the total after adding the tax. Display the meal cost,
* tax amount, tip amount, and total bill on the screen.
*
* Computation is based on the formula:
* Tax = Meal charge x percentage on tax
* Tip = Meal charge x percentage on tip
* Bill = Meal charge + Tax + Tip
* ______________________________________________________________________________
* INPUT
* mealCharge : Charge for food
* percentageOnTax : The percentage of tax in meal charge
* percentageOnTip : The percentage of tip in meal charge
* OUTPUT
* tax : Charge for tax
* tip : Charge for tip
* bill : The total cost on this meal
*
*******************************************************************************/
#include <iostream>
using namespace std;
int main()
{
float mealCharge; //INPUT - Charge for food
float percentageOnTax; //INPUT - The percentage of tax in meal charge
float percentageOnTip; //INPUT - The percentage of tip in meal charge
float tax; //OUTPUT - Charge for tax
float tip; //OUTPUT - Charge for tip
float bill; //OUTPUT - The total cost on this meal
//
// Initialize Program Variables
mealCharge = 44.50;
percentageOnTax = 0.0675;
percentageOnTip = 0.15;
//
//Output Result
cout << "The meal cost is: $"<< mealCharge << endl;
//
//Compute the tax
tax = mealCharge * percentageOnTax;
//
//Output Result
cout << "The amount of tax on this meal is : $" << tax <<endl;
//
//Compute the tip
tip = mealCharge * percentageOnTip;
//
//Output Result
cout << "The amount of tip on this meal is : $" << tip <<endl;
//
//Compute the total bill
bill = mealCharge + tax + tip;
//
//Output Result
cout << "The total bill is" << bill << endl;
return 0;
}