//Devin Scheu CS1A Chapter 2, P. 81, #3
//
/**************************************************************
*
* CALCULATE TOTAL SALES TAX
* ____________________________________________________________
* This program calculates the totalSalesTax given a
* totalCost, a stateTaxPercentage and a countyTaxPercentage.
*
* Computation is based on the formula:
* totalSalesTax = ((stateTaxPercentage / 100) * totalCost) + ((countyTaxPercentage / 100) * totalCost)
* ____________________________________________________________
* INPUT
* totalCost : Total cost of purchase in dollars (as a double 23.76)
* stateTaxPercentage : Percentage of state sales tax (as a double: 4.7)
* countyTaxPercentage : Percentage of county sales tax (as a double: 2.8)
*
* OUTPUT
* totalSalesTax : The amount of tax paid (in dollars: $4.57)
*
**************************************************************/
#include <iostream>
#include <iomanip>
using namespace std;
int main () {
//Variable Declarations
double totalCost; //INPUT - Total cost of purchase in dollars (as a double 23.76)
double stateTaxPercentage; //INPUT - Percentage of state sales tax (as a double: 4.7)
double countyTaxPercentage; //INPUT - Percentage of county sales tax (as a double: 2.8)
double totalSalesTax; //OUTPUT - The amount of tax paid (in dollars: $4.57)
//Variable Initialization
totalCost = 52;
stateTaxPercentage = 4;
countyTaxPercentage = 2;
//Calculate Sales Generated
totalSalesTax = ((stateTaxPercentage / 100) * totalCost) + ((countyTaxPercentage / 100) * totalCost);
//Output Result
cout << fixed << setprecision(2) << "The total sales tax is: $" << totalSalesTax << endl;
} //end of main()