Can anyone spot check my code for any issues? The question is as follows:
You have a summer job that pays $15.50/hr, the total tax you pay on your total income at the end of the summer is 14%. After you pay taxes you spend 10% on new cloths, then 1% of whats left from that on school supplies. After that you think about investing in savings bonds:
- If you invest nothing into savings bonds then your parents decide to invest 1% of the money you made after taxes, clothes, and school supplies for you. How much did they invest?
- If you invest up to 25% of your net income, your parents invest $0.25 for every dollar you invest PLUS 1% of the money you save after taxes, clothes, and school supplies. How much did they invest?
- If you more than 25% of your net income, your parents invest $0.40 for every dollar you invest PLUS 2% of the money you save after taxes, clothes, and school supplies. How much did they invest?
int main()
{
const double hourlyrate;
const double numofhrs;
double pay;
double pat; //pay after taxes
double paca; //pay after taxes and clothes & accessories
double pass; /pay after school supplies
const double sba; //savings bond answer
double sbfp; //savings bonds from parents
double bonussbfp; //bonus from your parents to savings bonds invested
cout << "Enter your number of hours worked: ";
cin >> numofhrs;
cout << endl;
hourlyrate * numofhours = pay //pay before taxes
pay - (pay * 0.14) = pat //pay after taxes are taken out
pat - (pat * 0.10) = paca //pay after taxes and clothes & accessories
paca - (paca * 0.01) = pass //pay after taxes,clothes, and school supplies
cout << "How much did you invest on savings bonds after taxes? ";
cin >> sba;
if (sba == 0)
sbfp = pass * 0.01 //Amount invested by parents for savings bonds after you pay for taxes, clothes, and school supplies (1%) .
cout << "Looks like your parents invested 1% of your savings for you! They invested = " << sbfp << endl;
else if (sba <= pat * 0.25)
sbfp = (sba * 0.25) + sba //Amount invested by parents for savings bonds ($0.25 for every $1 invested).
bonussbfp = sbfp + (pass * 0.01) //Amount invested by parents for 1% of every dollar invested after taxes, clothes, and school supplies.
cout << "Looks like your parents invested $0.25 for every dollar of your money you put into savings bonds for you! They invested = " << sbfp << endl;
cout << "They also added 1% of your money after taxes, clothes, and school supplies to your invested! They invested a total of = " << bonussbfp << endl;
else
sbfp = (sba * 0.40) +sba //Amount invested by parents for savings bonds ($0.40 for every $1 invested).
bonussbfp = sbfp + (pass *0.02) //Amount invested by parents for + $2 for every dollar invested after taxes, clothes, and school supplies.
cout << "Looks like your parents invested $0.40 for every dollar of your money you put into savings bonds for you! They invested = " << sbfp << endl;
cout << "They also added 2% of your money after taxes, clothes, and school supplies to your invested! They invested a total of = " << bonussbfp << endl;