// Marvyn De La Torre CS1A Chapter 2, P. 81, #3
/****************************************************************
* Compute Total Sales Tax
* --------------------------------------------------------------
* This program calculates the state tax, county tax, and total
* sales tax on a $52.00 purchase.
* --------------------------------------------------------------
* INPUT
* purchaseAmount : Cost of the purchase
* stateTaxRate : State sales-tax rate
* countyTaxRate : County sales-tax rate
*
* OUTPUT
* totalSalesTax : Combined state and county sales tax
****************************************************************/
#include <iostream>
using namespace std;
int main()
{
float purchasePrice; // INPUT - Cost of purchase
float stateTax; // OUTPUT - State sales tax
float countyTax; // OUTPUT - County sales tax
float totalSalesTax; // OUTPUT - Total sales tax
// Set the purchase price
purchasePrice = 52.00;
// Compute state and county tax
stateTax = purchasePrice * 0.04;
countyTax = purchasePrice * 0.02;
// Compute total sales tax
totalSalesTax = stateTax + countyTax;
// Display result
cout << "The total sales tax is $" << totalSalesTax << endl;
return 0;
}