1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
|
#include <iostream>
#include <string>
#include <iomanip>
#include <math.h>
using namespace std;
using std::cout ;
using std::cin ;
using std::endl ;
//Global Declarations of Variables
double ihoursm = 0, ihourst = 0, ihoursw = 0, ihoursth =0, ihoursf = 0, ihourss = 0, ihourssu = 0, ohoursm= 0,
ohourst = 0, ohoursw = 0, ohoursth =0, ohoursf = 0, ohourss = 0, ohourssu = 0, iwage = 0, mhours, net_pay,
thours, whours, thhours, fhours, shours, suhours, totalhours, federal, oasdi, medicare, state, retirement = 0;
int grosspay;
string cname ;
int main ()
{
//Enter Employee Information
cout << "\n\nEnter the employee name =" ;
cin >> cname;
cout << "\n\nEnter the time clocked in on Monday =" ;
cin >> ihoursm;
cout << "\n\nEnter the time clocked out on Monday =" ;
cin >> ohoursm;
cout << "\n\nEnter the time clocked in on Tuesday =" ;
cin >> ihourst;
cout << "\n\nEnter the time clocked out on Tuesday =" ;
cin >> ohourst;
cout << "\n\nEnter the time clocked in on Wednesday =" ;
cin >> ihoursw;
cout << "\n\nEnter the time clocked out on Wednesday =" ;
cin >> ohoursw;
cout << "\n\nEnter the time clocked in on Thursday =" ;
cin >> ihoursth;
cout << "\n\nEnter the time clocked out on Thursday =" ;
cin >> ohoursth;
cout << "\n\nEnter the time clocked in on Friday =" ;
cin >> ihoursf;
cout << "\n\nEnter the time clocked out on Friday =" ;
cin >> ohoursf;
cout << "\n\nEnter the time clocked in on Saturday =" ;
cin >> ihourss;
cout << "\n\nEnter the time clocked out on Saturday =" ;
cin >> ohourss;
cout << "\n\nEnter the time clocked in on Sunday =" ;
cin >> ihourssu;
cout << "\n\nEnter the time clocked out on Sunday =" ;
cin >> ohourssu;
cout << "\n\nEnter his or her hourly wage =" ;
cin >> iwage;
//Determine if hours are greater than 40
{
//Do Calculations
float val = 0.00;
float rounded_down = floorf(val * 100) / 100;
float nearest = floorf(val * 100 + 0.5) / 100;
float rounded_up = ceilf(val * 100) / 100;
mhours = (double) (ohoursm - ihoursm) ;
thours = (double) (ohourst - ihourst) ;
whours = (double) (ohoursw - ihoursw) ;
thhours = (double) (ohoursth - ihoursth) ;
fhours = (double) (ohoursf - ihoursf) ;
shours = (double) (ohourss - ihourss) ;
suhours = (double) (ohourssu - ihourssu) ;
totalhours = (double) (mhours + thours + whours + thhours + fhours + shours + suhours) ;
grosspay = (totalhours * iwage) ;
federal = (grosspay * 0.04) ;
oasdi = (grosspay * 0.035) ;
medicare = (grosspay * 0.012) ;
state = (grosspay * 0.038) ;
retirement = (grosspay * 0.05);
net_pay = (grosspay - federal - oasdi - medicare - state - retirement - 4.50 - 115.89 - 42.02 - 13.98 - 16.35);
}
{//Display Employee Details
cout << "\n\n" ;
cout << "Employee Name............=" <<cname<< endl ;
cout << "Total Hours ...... =" <<totalhours<< endl ;
cout << "Gross Pay.........="<<totalhours * iwage<< endl ;
cout << "Net Pay...........="<<net_pay<< endl ;
}//End of the Primary Statement
}//End of Int Main
|