//Julio Ramirez CSC5 Chapter 2, P. 81, #4
/*******************************************************************************
* Compute Restrant Bill
* _____________________________________________________________________________
* This program computes the tax and tip (in any appliable currency) based on
* the meal charge,
* tax percentage and tip percentage.
*
* Computation is based on the Formula:
* Tax Amount = Meal Charge * Tax Percentage
* Tip Amount = (Meal Charge + Tax) * Tip Percentage
* Total Bill = Meal Charge + Tax Amount + Tip Amount
* _____________________________________________________________________________
* INPUT
* meal : Meal charge
* taxPer : Tax percentage
* tipPer : Tip percentage
*
* OUTPUT
* tax : Tax amount
* tip : Tip amount
* total : Total bill
*
******************************************************************************/
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
float meal; //Input - Meal charge
float taxPer; //Input - Tax Percentage
float tipPer; //Input - Tip Percentage
float tax; //Output - Tax amount
float tip; //Output - Tip amount
float total; //Output - Total
// Initialize Program Variables
meal = 44.50;
taxPer = 0.0675;
tipPer = .15;
// Compute Tax
tax = meal * taxPer;
// Compute Tip
tip = (meal + tax) * tipPer;
// Compute Total
total = meal + tip + tax;
// Output Results
cout << "Sub Total : $" << setprecision(4) << showpoint << meal;
cout << "\nTax" << setw(10) << ": $" << setprecision(3) << showpoint << tax;
cout << "\nTip" << setw(10) << ": $" << setprecision(3) << showpoint << tip;
cout << "\nTotal" << setw(8) << ": $" << setprecision(4) << showpoint << total;
return 0;
}