/******************************************************************************************
* Name: Marcelo Vargas
* Chapter 2 Homework
* Class: CSC5
* #3
*
* Sales Tax
*
* This program computes the total sales tax on a $52 purchase with a 4% state tax rate
* and a 2% country tax rate
*__________________________________________________________________________________________
*INPUT
* price :the amount of the purchase ($52)
* stateTaxRate :the tax % of the state tax (%4)
* countryTaxRate :the tax % of the country tax (%2)
*
* OUTPUT
* statetax :sum of state tax
* countrytax :sum of country tax
* total :sum of price, statetax, and countrytax
******************************************************************************************/
//importing "iostream" & "iomanip" from stream library
#include <iostream>
#include <iomanip>
using namespace std;
int main(){
// Declare variables
float price; //Inputprice of the purchase
float stateTaxRate; //Input statetax peercentage
float countryTaxRate; //Input countrytax percentage
float statetax; //Output of state tax
float countrytax; //Output of country tax
float totaltax; //Output of total tax
price = 52.0;
stateTaxRate = 0.04;
countryTaxRate = 0.02;
//calculate the taxes
statetax = price * stateTaxRate;
countrytax = price * countryTaxRate;
totaltax = statetax + countrytax;
//outputs the total of the calculations
cout << fixed << setprecision(2);
cout << "State sales tax: $" << statetax << endl;
cout << "contry Sales Tax: $" << countrytax << endl;
cout << "Total Sales Tax: $" << totaltax << endl;
return 0;
}