//Julio Ramirez CSC5 Chapter 2, P. 81, #3
/*******************************************************************************
* Sales Tax
* _____________________________________________________________________________
* This program computes the total sales tax on an puchase based on the county
* sales tax and state stales tax.
*
* Computation is based on the Formula:
* Pre Tax Cost = Puchase Cost / (1 + County Sales tax + State Sales Tax)
* and
* Total Tax = Puchase Cost - Pre Tax Cost
* _____________________________________________________________________________
* INPUT
* cost : Puchase cost
* stateTax : State sales tax
* countyTax : County slaes tax
*
* OUTPUT
* preTax : Pre tax cost
* totalTax : Total sales tax
*
******************************************************************************/
#include <iostream>
using namespace std;
int main()
{
float cost; //Input - Puchase cost
float stateTax; //Input - State Sales Tax
float countyTax; //Input - County Sales Tax
float preTax; //Output - Pre tax cost
float totalTax; //Output - Total Sales Tax
// Initialize Program Variables
cost = 52;
stateTax = .04;
countyTax = .02;
// Compute Pre Tax Cost
preTax = cost / (1+ stateTax + countyTax);
// Compute Total Tax
totalTax = cost - preTax;
// Output Results
cout << "The total tax on a $" << cost << " purchase is $" << totalTax;
return 0;
}