Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- using namespace std;
- int main() {
- const double PAY_RATE = 15.50;
- const double TAX_RATE = 0.14;
- const double CLOTHES_RATE = 0.10;
- const double SUPPLIES_RATE = 0.01;
- const double SAVINGS_BONDS_RATE = 0.25;
- const double PARENTS_MATCH_RATE = 0.50;
- double hoursWorked;
- cout << "Enter the number of hours worked per week: ";
- cin >> hoursWorked;
- double incomeBeforeTax = PAY_RATE * hoursWorked * 5;
- double taxAmount = incomeBeforeTax * TAX_RATE;
- double incomeAfterTax = incomeBeforeTax - taxAmount;
- double clothesAmount = incomeAfterTax * CLOTHES_RATE;
- double suppliesAmount = incomeAfterTax * SUPPLIES_RATE;
- double savingsBondsAmount = (incomeAfterTax - clothesAmount - suppliesAmount) * SAVINGS_BONDS_RATE;
- double parentsMatchAmount = savingsBondsAmount * PARENTS_MATCH_RATE;
- cout << fixed << setprecision(2);
- cout << "Income before tax: $" << incomeBeforeTax << endl;
- cout << "Income after tax: $" << incomeAfterTax << endl;
- cout << "Money spent on clothes and other accessories: $" << clothesAmount << endl;
- cout << "Money spent on school supplies: $" << suppliesAmount << endl;
- cout << "Money spent on savings bonds: $" << savingsBondsAmount << endl;
- cout << "Money parents spend on additional savings bonds: $" << parentsMatchAmount << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement