Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5.     int hours_worked, number_dependents;
  6.     double rate_pay = 16.78, ss_tax = 0.06, fed_tax = 0.14, st_tax = 0.05, un_due = 10.00, ext_h = 35.00;
  7.     double gross_pay, net_pay, ss_withheld, fed_withheld, st_withheld;
  8.  
  9.  
  10.     cout << "This program calculates net pay using hours worked and rate per hour\n";
  11.          << "while crediting overtime pay of a rate and a half\n";
  12.          << "minus a 6% Social Security Tax, 14% Federal Income Tax, 5% State Tax,\n";
  13.          << "$10 of union dues, and withholds an additional $35 insurance fee\n";
  14.          << "if employee has 3 or more dependents.\n";
  15.          << "Please enter the number of weekly hours worked:\n";
  16.    
  17.     cin >> hours_worked;
  18.  
  19.     cout << "Please enter the number of dependents:\n";
  20.  
  21.     cin >> number_dependents;
  22.  
  23.     if (hours_worked>40)
  24.     {
  25.         gross_pay = rate_pay*40 + 1.5*rate_pay*(hours_worked-40);
  26.     }
  27.     else
  28.     {
  29.         gross_pay = rate_pay*hours_worked;
  30.     }
  31.  
  32.     cout.setf(ios::fixed);
  33.     cout.setf(ios::showpoint);
  34.     cout.precision(2);
  35.  
  36.     {
  37.         ss_withheld=gross_pay*ss_tax;
  38.         fed_withheld =gross_pay*fed_tax;
  39.         st_withheld=gross_pay*st_tax;
  40.  
  41.         if (number_dependents>= 3)
  42.         {
  43.             net_pay=gross_pay-ss_withheld-fed_withheld-st_withheld-un_due-ext_h;
  44.         }
  45.         else
  46.             net_pay=gross_pay-ss_withheld-fed_withheld-st_withheld-un_due;
  47.        
  48.     }      
  49.    
  50. cout << "Hours the employee worked for the week:" << hours_worked << endl;
  51.      << "Employee rate of pay per hour: $" << rate_pay << endl;
  52.      << "Number of dependents:" << number_dependents << endl;
  53.      << "The gross pay for the employee is: $" << gross_pay << endl;
  54.      << "Social security tax withheld is: $" << ss_withheld << endl;
  55.      << "Federal income tax withheld is: $" << fed_withheld << endl;
  56.      << "State tax withheld is: $" << st_withheld << endl;
  57.      << "Weekly union due is $10.00\n";
  58.      << "The net pay for the employee is: $" << net_pay << endl;
  59.  
  60.     system("pause");
  61.     return 0;
  62.  
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement