Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.10 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main ()
  6. {
  7.     const double SOCIAL_SEC = 0.06,FEDERAL_RATE = 0.14,STATE_RATE = 0.05,OVERTIME_RATE = 1.5;
  8.    
  9.    
  10.     int hours,NUMBER_DEPENDENTS = 35.00;
  11.     double rate,social,state,federal,netpay,gross
  12.     ,dependents,Union = 10.00,overtime;
  13.    
  14.    
  15.     cout.setf(ios::fixed);
  16.     cout.setf(ios::showpoint);
  17.     cout.precision(2);
  18.    
  19.     do
  20.     {
  21.     cout << "Please Enter a value of salary rate per hours : $";
  22.     cin >> rate;
  23.        
  24. }
  25.     while (rate < 10.00 || rate > 20.00);
  26.    
  27.     cout << endl;
  28.    
  29.     hours = 0;
  30.     while (hours < 1 || hours > 60)
  31.     {
  32.         cout << "Please Enter a value of the total hours worked: hrs";
  33.         cin >> hours;
  34.        
  35.         cout << "Please Enter a Number Dependent to You $35.00 per dependents: ";
  36.         cin >> dependents;
  37.        
  38.         }
  39.     if (hours > 48)
  40.     gross = (48 * rate)+
  41.     (hours-48)*rate*OVERTIME_RATE;
  42.    
  43.     else
  44.    
  45.     gross = hours * rate;
  46.     overtime = (hours-48) * rate;
  47.     social = gross * SOCIAL_SEC;
  48.     federal = gross * FEDERAL_RATE;
  49.     state = gross * STATE_RATE;
  50.     dependents = dependents * NUMBER_DEPENDENTS;
  51.     Union = 10.00;
  52.     netpay = gross-(state+federal+social+Union
  53.     +dependents);
  54.    
  55.     cout << endl << endl
  56.     << "_______________________________\n"
  57.     << " * \tPAYROLL\t ***\n "
  58.     << "______________________________\n"
  59.     << "Hourly Rate  : \t " << rate << endl
  60.     << "Hours Worked : \t " << hours << endl
  61.     << "Over Time    : \t " << overtime << endl
  62.     << "Gross Pay    : \t " << gross << endl
  63.     << "Social Sec   :   " << social << " at " <<
  64.     SOCIAL_SEC << endl
  65.     << "Federal Tax  : \t " << federal << " at " <<
  66.     FEDERAL_RATE << endl
  67.     << "State Tax    : \t " << state << " at " <<
  68.     STATE_RATE << endl
  69.     << "Dependents   : \t "<< dependents
  70.     << endl
  71.     << "UNION Dues   : \t " << Union << endl;
  72.    
  73.     cout << "_______________________________\n";
  74.     cout << "Net Pay: \t " << netpay <<endl;
  75.     cout << "_______________________________\n";
  76.    
  77.    
  78.     return 0;
  79. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement