You are on page 1of 2

//This program calculate the requirements in question 18 page 120

#include <iostream>
using namespace std;
int main()
{
double tax_rate=0.14, cloth_acce_rate= 0.10,
school_supp_rate= 0.01, bonds_rate= 0.25, parents_bonds_rate=
0.50;
double incomeBeforeTAX, incomeAfterTAX, money_cloth_acce,
money_schoolSupp, money_bonds, money_parentsBonds;
double payRate, workedHours_WK1, workedHours_WK2,
workedHours_WK3, workedHours_WK4, workedHours_WK5,
totalWorkedHours;
cout<<"Enter pay rate for an hour:"<<endl;
cin>>payRate;
cout<<"Enter number of hours worked in week 1:"<<endl;
cin>>workedHours_WK1;
cout<<"Enter number of hours worked in week 2:"<<endl;
cin>>workedHours_WK2;
cout<<"Enter number of hours worked in week 3:"<<endl;
cin>>workedHours_WK3;
cout<<"Enter number of hours worked in week 4:"<<endl;
cin>>workedHours_WK4;
cout<<"Enter number of hours worked in week 5:"<<endl;
cin>>workedHours_WK5;
totalWorkedHours = workedHours_WK1 + workedHours_WK2 +
workedHours_WK3 + workedHours_WK4 + workedHours_WK5;
//a
incomeBeforeTAX = payRate * totalWorkedHours;
incomeAfterTAX = incomeBeforeTAX-(incomeBeforeTAX*tax_rate);
cout<<"Income before taxes is $"<<incomeBeforeTAX<<" and after
taxes is $"<<incomeAfterTAX<<endl;
//b
money_cloth_acce = incomeAfterTAX * cloth_acce_rate;
cout<<"The money spent on clothes and other accessories is
$"<<money_cloth_acce<<endl;
//c
money_schoolSupp = (incomeAfterTAX - (money_cloth_acce)) *
school_supp_rate;
cout<<"The money spent on school supplies is
$"<<money_schoolSupp<<endl;
//d
money_bonds = (incomeAfterTAX (money_cloth_acce+money_schoolSupp)) * bonds_rate;
cout<<"The money to buy saving bonds is $"<<money_bonds<<endl;
//e
money_parentsBonds = money_bonds * parents_bonds_rate;
cout<<"The money that parents used to buy saving bonds is
$"<<money_parentsBonds<<endl;

system("pause");
return 0;

You might also like