// Elaine Torrez CS1A Chapter 2 P. 81, #3
/******************************************************************************************
*
* CALCULATE SALES TAX
*
* --------------------------------------------------------------------------------
*
* This program calculates the total sales tax on a $52 purchase.
* The program uses a state sales tax of 4% and a county sales tax of 2%.
*---------------------------------------------------------------------------------
*
* INPUT
* purchaseAmount : cost of the item before tax
* stateTaxRate : 4% (0.04)
* countyTaxRate : 2% (0.02)
*
* OUTPUT
*
* stateTax : state sales tax
* countyTax : county sales tax
* totalTax : total of state + county taxes
*
*******************************************************************************************/
#include <iostream>
#include <iomanip> // Included for fixed and setprecision
using namespace std;
int main ()
{
double purchaseAmount; // Cost of the purchase before tax
double stateTax; // 4% of the purchase
double countyTax; // 2% of the purchase
double totalTax; // Total tax amount
purchaseAmount = 52.00; // INPUT
stateTax = purchaseAmount * 0.04; // Compute state tax
countyTax = purchaseAmount * 0.02;// Compute county tax
totalTax = stateTax + countyTax; // Compute total tax
cout << fixed << setprecision(2);
// OUTPUT
cout << "Purchase Amount : $" << purchaseAmount << endl;
cout << "State Tax (4%) : $" << stateTax << endl;
cout << "County Tax (2%) : $" << countyTax << endl;
cout << "Total Tax : $" << totalTax << endl;
return 0;
}