Ok I need help with this problem So I solved this problem an

Ok I need help with this problem.

So I solved this problem. and now another problem needs the solution of the first modified into different conditions. check it out.

the question that I solved:

You find an exciting summer job for five weeks. It pays, say, $15.50 per hour. Suppose that the local tax you pay on your summer job income is 14%. After paying the taxes, you spend 10% of your net income to buy new clothes and other accessories for the next school year and 1% to buy school supplies. After buying clothes and school supplies, you use 25% of the remaining money to buy savings bonds. For each dollar you spend to buy savings bonds, your parents spend $0.50 to buy additional savings bonds for you. Write a program that prompts the user to enter the pay rate for an hour and the number of hours you worked each week.

So I got this code:

#include
#include

using namespace std;

void main()

{

double hourlyWage, totalHoursworked, incomeBeforetax, incomeAftertax, additionalSavingsBonds, totalincome, spentONclothes, spentONsupplies, income, income_two, spentONbonds, summertax, clothes, schoolsupplies, savingsbonds;

summertax = 0.14;
clothes = 0.10;
schoolsupplies = 0.01;
savingsbonds = 0.25;

cout << \" Enter hourly wage: $\";
cin >> hourlyWage;
cout << \"\ \";

cout << \" Enter total hours worked: \";
cin >> totalHoursworked;
cout << \"\ \";

totalincome = (hourlyWage * totalHoursworked);
incomeBeforetax = totalincome;
incomeAftertax = totalincome - (totalincome * summertax);
spentONclothes = (incomeAftertax * clothes);
income = incomeAftertax - spentONclothes;
spentONsupplies = (income * schoolsupplies);
income_two = income - spentONsupplies;
spentONbonds = (income_two * savingsbonds);
additionalSavingsBonds = spentONbonds * 0.50;

cout << \" Your income before taxes from your summer job: $\" << setprecision(2) << fixed << incomeBeforetax << endl << endl;
cout << \" Your income after taxes from your summer job: $\" << setprecision(2) << fixed << incomeAftertax << endl << endl;
cout << \" The amount of money you spent on clothes: $\" << setprecision(2) << fixed << spentONclothes << endl << endl;
cout << \" The amount you spent on school supplies: $\" << setprecision(2) << fixed << spentONsupplies << endl << endl;
cout << \" The amount you spent on buying savings bonds: $\" << setprecision(2) << fixed << spentONbonds << endl << endl;
cout << \" The money your parents spent to buy additional savings bonds: $\" << setprecision(2) << fixed << additionalSavingsBonds << endl << endl;

}

Now this question is asking to change the data, but I got kind of confused about it. This is the part I need help with.

Redo the previous programming exercise, taking into account that your parents buy additional savings bond for you as follows:

[a] If you do not spend any money to buy savings bonds, then because you had a summer job, your parents buy savings bonds for you in an amount equal to 1% of the money you save after paying taxes and buying clothes, other accessories and school supplies.

[b] If you spend up to 25% of your net income to buy savings bonds, your parents spend $0.25 for each dollar you spend to buy savings bonds, plus money equal to 1% of the money you save after paying taxes and buying clothes, other accessories, and school supplies.

[c] If you spend more than 25% of your net income to buy savings bonds, your parents spend $0.40 for each dollar you spend to buy savings bonds, plus money equal to 2% of the money you save after paying taxes and buying clothes, other accessories, and school supplies.

Solution

//C++ code

#include <iostream>
#include <string>
#include <vector>
#include <iomanip>
#include <map>


using namespace std;

int main()
{

double hourlyWage, totalHoursworked, incomeBeforetax, incomeAftertax, additionalSavingsBonds, totalincome, spentONclothes, spentONsupplies, income, income_two, spentONbonds, summertax, clothes, schoolsupplies, savingsbonds;

summertax = 0.14;
clothes = 0.10;
schoolsupplies = 0.01;

cout << \" Enter hourly wage: $\";
cin >> hourlyWage;
cout << \"\ \";

cout << \" Enter total hours worked: \";
cin >> totalHoursworked;
cout << \"\ \";

// now we take percentage saving bond from user
cout << \" Enter percentage of savings on bonds: %\";
cin >> savingsbonds;
cout << \"\ \";

// percentage to decimal conversion
savingsbonds = savingsbonds/100;


totalincome = (hourlyWage * totalHoursworked);
incomeBeforetax = totalincome;
incomeAftertax = totalincome - (totalincome * summertax);
spentONclothes = (incomeAftertax * clothes);
income = incomeAftertax - spentONclothes;
spentONsupplies = (income * schoolsupplies);
income_two = income - spentONsupplies;
spentONbonds = (income_two * savingsbonds);

// If you do not spend any money to buy savings bonds
if(spentONbonds == 0)
    additionalSavingsBonds = income_two * 0.01;
//If you spend up to 25% of your net income to buy savings bonds
else if(spentONbonds <= 0.25*income_two)
    additionalSavingsBonds = income_two*0.01 + spentONbonds*0.25;
// If you spend more than 25% of your net income to buy savings bonds
else if(spentONbonds > 0.25*income_two)
    additionalSavingsBonds = income_two*0.02 + spentONbonds*0.40;

cout << \" Your income before taxes from your summer job: $\" << setprecision(2) << fixed << incomeBeforetax << endl << endl;
cout << \" Your income after taxes from your summer job: $\" << setprecision(2) << fixed << incomeAftertax << endl << endl;
cout << \" The amount of money you spent on clothes: $\" << setprecision(2) << fixed << spentONclothes << endl << endl;
cout << \" The amount you spent on school supplies: $\" << setprecision(2) << fixed << spentONsupplies << endl << endl;
cout << \" The amount you spent on buying savings bonds: $\" << setprecision(2) << fixed << spentONbonds << endl << endl;
cout << \" The money your parents spent to buy additional savings bonds: $\" << setprecision(2) << fixed << additionalSavingsBonds << endl << endl;

return 0;
}

/*
output:

Enter hourly wage: $20

Enter total hours worked: 34

Enter percentage of savings on bonds: %40

Your income before taxes from your summer job: $680.00

Your income after taxes from your summer job: $584.80

The amount of money you spent on clothes: $58.48

The amount you spent on school supplies: $5.26

The amount you spent on buying savings bonds: $208.42

The money your parents spent to buy additional savings bonds: $93.79

*/

Ok I need help with this problem. So I solved this problem. and now another problem needs the solution of the first modified into different conditions. check it
Ok I need help with this problem. So I solved this problem. and now another problem needs the solution of the first modified into different conditions. check it
Ok I need help with this problem. So I solved this problem. and now another problem needs the solution of the first modified into different conditions. check it

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site