You found an exciting summer job for five weeks. It pays, say, $15.50 per hour. Suppose that the total 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. Using C++, write a program that prompts the user to enter the pay rate for an hour and the number of hours you worked each week. The program then outputs the following:
- Your income before and after taxes from your summer job.
- The money you spend on clothes and other accessories.
- The money you spend on school supplies.
- The money you spend to buy savings bonds.
- The money your parents spend to buy additional savings bonds for you.
Write the Code:
/*
Project: Summer Job
Description: User inputs hourly wage and hours worked.
Program calculates budget and outputs results.
*/
#include <iostream>;
using namespace std;
int main()
{
float wage = 0;
float hoursWorked = 0;
float totalPay = 0;
float afterTaxes = 0;
float clothingCost = 0;
float schoolSuppliesCost = 0;
float savingsBonds = 0;
float remainingMoney = 0;
float parentsBonds = 0;
cout << "Please enter your hourly wage:";
cin >> wage;
cout << "\nPlease enter the hours worked per week:";
cin >> hoursWorked;
totalPay = hoursWorked * wage * 5;
cout << "\nAfter five weeks, your total pay before taxes is $" << totalPay;
afterTaxes = totalPay * .86;
cout << "\nAfter taxes, you made $" << afterTaxes;
clothingCost = afterTaxes * .1;
cout << "\nYou paid $" << clothingCost << " for clothing";
schoolSuppliesCost = afterTaxes * .01;
cout << "\nYou paid $" << schoolSuppliesCost << " for school supplies";
remainingMoney = afterTaxes - clothingCost - schoolSuppliesCost;
savingsBonds = remainingMoney * .25;
cout << "\nYou paid $" << savingsBonds << " for savings bonds.";
parentsBonds = savingsBonds * .5;
cout << "\nYour parents paid an additional $" << parentsBonds << " for savings bonds.";
return 0;
}