//Charlotte Davies-Kiernan CS1A Chapter 2 P.82 #3
//
/******************************************************************************
*
* Compute Sales Tax
* ____________________________________________________________________________
* This program calculates the total sales tax on an item assuming the
* state sales tax and county sales tax are the percentages given
*
* Computation is based on the formulas:
* sale total = purchase amount + total tax
* ____________________________________________________________________________
* INPUT
* purchaseAmount : Price of item before any tax added
* stateTaxRate : Percentage of state tax
* countyTaxRate : Percentage of county tax
*
* OUTPUT
* stateTax : Amount of tax that will be added from state
* countyTax : Amount of tax that will be added from county
* totalTax : Constant for state and county tax added together
* totalAmount : Price of purchase with everything included
*****************************************************************************/
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
float purchaseAmount; //INPUT - price of item with nothing added
float stateTaxRate; //INPUT - Percentage of state tax
float countyTaxRate; //INPUT - Percentage of county tax
float stateTax; //OUTPUT - Amount of tax from state
float countyTax; //OUTPUT - Amount of tax from county
float totalTax; //OUTPUT - Amount of tax from both state and county
float totalAmount; //OUTPUT - Price of purchase with everything included
//
// Initialize Program Variables
purchaseAmount = 52.0;
stateTaxRate = 0.04;
countyTaxRate = 0.02;
//
// Compute Amount for State Tax
stateTax = purchaseAmount * stateTaxRate;
//
// Output Result
cout << "State Sales Tax : $" << stateTax << endl;
//
// Compute Amount for County Tax
countyTax = purchaseAmount * countyTaxRate;
//
// Output Result
cout << "County Sales Tax: $" << countyTax << endl;
//
// Compute Total Tax Amount
totalTax = stateTax + countyTax;
//
// Output Result
cout << "Total Tax: $" << totalTax << endl;
//
// Comput Final Sale Price
totalAmount = purchaseAmount + totalTax;
//
// Output Result
cout << "Total Amount due: $" << totalAmount << endl;
return 0;
}