//Devin Scheu CS1A Chapter 2, P. 81, #4
//
/**************************************************************
*
* CALCULATE RESTAURANT BILL
* ____________________________________________________________
* This program calculates the restaurantBill given a
* totalBill, a taxPercent and a tipPercent.
*
* Computation is based on the formulas:
* billTaxAmount = restaurantBill * (taxPercent / 100);
* billTipAmount = (restaurantBill + billTaxAmount) * (tipPercent / 100);
* restaurantBill = totalBill + billTaxAmount + billTipAmount
* ____________________________________________________________
* INPUT
* restaurantBill : Total cost of bill in dollars (as a double EX: 23.76)
* taxPercent : Percentage of sales tax (as a double EX: 4.7)
* tipPercent : Percentage bill to be tipped (as a double EX: 2.8)
*
* PROCESSING
* billTaxAmount : The amount taxed (in dollars EX: $4.57)
* billTipAmount : The amount tipped (in dollars EX: $4.57)
*
* OUTPUT
* billTotal : The restuarant bills total amount (in dollars EX: $4.57)
*
**************************************************************/
#include <iostream>
#include <iomanip>
using namespace std;
int main () {
//Variable Declarations
double restaurantBill; //INPUT - Total cost of bill in dollars (as a double EX: 23.76)
double taxPercent; //INPUT - Percentage of sales tax (as a double EX: 4.7)
double tipPercent; //INPUT - Percentage bill to be tipped (as a double EX: 2.8)
double billTaxAmount; //PROCESSING - The amount taxed (in dollars EX: $4.57)
double billTipAmount; //PROCESSING - The amount tipped (in dollars EX: $4.57)
double billTotal; //OUTPUT - The restuarant bills total amount (in dollars EX: $4.57
//Variable Initialization
restaurantBill = 44.50;
taxPercent = 6.75;
tipPercent = 1.5;
//Calculate Amount For Tax and Tip
billTaxAmount = restaurantBill * (taxPercent / 100);
billTipAmount = (restaurantBill + billTaxAmount) * (tipPercent / 100);
//Caluclate Restaurant Bill
billTotal = billTaxAmount + billTipAmount + restaurantBill;
//Output Result
cout << fixed << setprecision(2) << "The total bill is: $" << billTotal << endl;
} //end of main()