Guest User

Untitled

a guest
Jun 20th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.75 KB | None | 0 0
  1. #include <iostream>
  2. #include <iomanip>
  3. #include <fstream>
  4. using namespace std;
  5. int main () {
  6.     const double TAXRATE = 0.0307, OVERTIMEV = 35.0;
  7.     double gross, tax, net, hoursworked, hourly;  //gross pay, PA taxes, Net pay, Hourly Rate, and Hours worked.
  8.     long overtime, undertime;
  9.     cout << fixed<<showpoint;
  10.    
  11.     //ask for data
  12.     cout<<"--Welcome to the Penn State Wilkes-Barre Payroll program--: "<<endl;
  13.     cout<<"Please enter data below: "<<endl;
  14.     cout<<endl;
  15.  
  16.     cout<<"Number of hours worked: ";
  17.     cin>>hoursworked;
  18.  
  19.     cout<<"Hourly rate of pay: ";
  20.     cin>>hourly;
  21.  
  22.         //Making variables gp, tax, and np.
  23.     if(hoursworked<=35.0)
  24.     {
  25.         undertime = hoursworked;
  26.         overtime=0;
  27.         gross=( hoursworked* hourly) ;
  28.     }
  29.     else
  30.     {
  31.         undertime = 35;
  32.         overtime = (hoursworked - OVERTIMEV) * hourly * 1.5 ;
  33.         gross= (undertime * hourly) + overtime;
  34.     }
  35.  
  36.    
  37.     tax=(gross*TAXRATE);
  38.     net=(gross-tax);
  39.     ofstream fout ("payroll.out");
  40.     cout<<endl;
  41.     cout<<"Penn State Wilkes Barre Payroll Report "<<endl;
  42.     cout<<endl;
  43.     cout<<setprecision(2)<<endl;
  44.     cout<<fixed<<showpoint;  //show results for equations
  45.     cout<<"Hours Worked         "<<setw(9)<<hoursworked<<endl;
  46.     cout<<"Hourly rate          "<<setw(9)<<hourly<<endl;
  47.     cout<<"Regular pay          "<<setw(9)<<undertime<<"  hours at  "<<hourly<<"   "<<undertime<<"   "<<endl;
  48.     cout<<"Overtime pay         "<<setw(9)<<hoursworked - undertime <<"  hours at  "<<hourly *1.5<<"   "<<overtime<<"    "<<endl;
  49.     cout<<"Gross pay            "<<setw(9)<<gross<<endl;
  50.     cout<<"Pa State tax (3.07%) "<<setw(9)<<tax<<endl;
  51.     cout<<"Net Pay               "<<setw(10)<<net<<endl;
  52.     cout<<endl;
  53.     cout<<endl;
  54.     cout<<"End of Results"<<endl;
  55.     cout<<"Your output has been sent to payroll.out"<<endl;
  56.  
  57.  
  58.  
  59.     system("pause");
  60.  
  61.     return 0;
  62. }
Add Comment
Please, Sign In to add comment