// Cameron Pham CS1A chapter 2, p. 81, #4
//
/******************************************************************************
*
* Displaying Meal Cost, Tax Amount, Tip Amount, and Total Bill for a Meal
*
* _____________________________________________________________________________
* This program computes and displays the tax and tip amount of a restaurant
* bill for a $44.50 meal charge based on the meal cost, tax percentage, and tip
* percentage after tax. It will also display the total bill.
*
* Computation is based on the formula:
* taxAmount = mealCost * taxPercent
* tipAmount = (mealCost + taxAmount) * tipPercent
* totalBill = taxAmount + tipAmount + mealCost
*
* _____________________________________________________________________________
* INPUT
* mealCost = initial charge of meal ($44.50)
* taxPercent = sales tax (6.75%)
* tipPercent = tip percent based on charge after tax (15%)
*
* OUTPUT
* taxAmount = charge of tax
* tipAmount = charge of tip after tax
* totalBill = computes total charge of meal
*
* ****************************************************************************/
#include <iostream>
using namespace std;
int main()
{
double mealCost; // INPUT - The initial charge of meal
double taxPercent; // INPUT - The tax rate percentage
double tipPercent; // INPUt - The tip percentage
double taxAmount; // OUTPUT - The charge of tax
double tipAmount; // OUTPUT - The charge of tip
double totalBill; // OUTPUT - The total charge
// Initialize Program Variables
mealCost = 44.50;
taxPercent = 0.0675;
tipPercent = 0.15;
// Computing Charges
taxAmount = mealCost * taxPercent;
tipAmount = (mealCost + taxAmount) * tipPercent;
totalBill = taxAmount + tipAmount + mealCost;
// Final Output
cout <<"Meal cost = $ " << mealCost << "0" << endl;
cout <<"Tax amount = $ " << taxAmount << endl;
cout << "Tip amount = $ " << tipAmount << endl;
cout << "Total bill = $ " << totalBill << endl;
return 0;
}