Advertisement
kingbode

Untitled

Feb 18th, 2023
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.40 KB | None | 0 0
  1. #include <iostream>
  2. #include <iomanip>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7.     const double PAY_RATE = 15.50;
  8.     const double TAX_RATE = 0.14;
  9.     const double CLOTHES_RATE = 0.10;
  10.     const double SUPPLIES_RATE = 0.01;
  11.     const double SAVINGS_BONDS_RATE = 0.25;
  12.     const double PARENTS_MATCH_RATE = 0.50;
  13.  
  14.     double hoursWorked;
  15.  
  16.     cout << "Enter the number of hours worked per week: ";
  17.     cin >> hoursWorked;
  18.  
  19.     double incomeBeforeTax = PAY_RATE * hoursWorked * 5;
  20.     double taxAmount = incomeBeforeTax * TAX_RATE;
  21.     double incomeAfterTax = incomeBeforeTax - taxAmount;
  22.  
  23.     double clothesAmount = incomeAfterTax * CLOTHES_RATE;
  24.     double suppliesAmount = incomeAfterTax * SUPPLIES_RATE;
  25.     double savingsBondsAmount = (incomeAfterTax - clothesAmount - suppliesAmount) * SAVINGS_BONDS_RATE;
  26.     double parentsMatchAmount = savingsBondsAmount * PARENTS_MATCH_RATE;
  27.  
  28.     cout << fixed << setprecision(2);
  29.     cout << "Income before tax: $" << incomeBeforeTax << endl;
  30.     cout << "Income after tax: $" << incomeAfterTax << endl;
  31.     cout << "Money spent on clothes and other accessories: $" << clothesAmount << endl;
  32.     cout << "Money spent on school supplies: $" << suppliesAmount << endl;
  33.     cout << "Money spent on savings bonds: $" << savingsBondsAmount << endl;
  34.     cout << "Money parents spend on additional savings bonds: $" << parentsMatchAmount << endl;
  35.  
  36.     return 0;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement