Professional Documents
Culture Documents
Pre-Final Exam IN Computer Programming C++ Provided The C++ Payroll Code
Pre-Final Exam IN Computer Programming C++ Provided The C++ Payroll Code
IN
int main()
{
int eid,elvl,found;
float perday,perhour,tin,tout,hour_per_day,overallhour;
float hourday[10];
float gross,sss,pagibig,philhealth,ca,net,total_deduction;
string ename,days;
if(found==1){
cout<<"**************************************************"<<endl;
cout<<"* TIME KEEP *"<<endl;
cout<<"**************************************************"<<endl<<endl;
cout<<"Welcome "<<ename<<"!";
switch(elvl){
case 1: perday=500; perhour=perday/8; break;
case 2: perday=400; perhour=perday/8; break;
default: perday=350; perhour=perday/8; break;
}
cout<<"\nPer Day: "<<perday;
for(int x=1;x<=5;x++){
switch(x){
case 1: days="Monday"; break;
case 2: days="Tuesday"; break;
case 3: days="Wednesday"; break;
case 4: days="Thursday"; break;
default: days="Friday"; break;
}
cout<<"\n\n * * * "<<days<<" * * * ";
cout<<"\nEnter Time IN: "; cin>>TIN;
tin=(atol(strtok(TIN,":")))*60 + atol(strtok(NULL,":"));
if(tin<480){tin=480;}
cout<<"Enter Time OUT: "; cin>>TOUT;
tout=(atol(strtok(TOUT,":")))*60 + atol(strtok(NULL,":"));
if(tout>1020){tout=1020;}
hour_per_day=(tout-tin)/60;
if(tout>=720 && tout>=780){hour_per_day=hour_per_day-1;}
hourday[x]=hour_per_day;
}
for(int x=1;x<=5;x++){
overallhour = overallhour + hourday[x];
}
system("clear");
//Deductions
cout<<"\nEnter Cash Advance: "; cin>>ca;
gross = overallhour * perhour;
sss = gross * 0.01;
pagibig = gross * 0.01;
philhealth = gross * 0.01;
total_deduction = sss + pagibig + philhealth + ca;
net = gross - total_deduction;
cout<<"**************************************************"<<endl;
cout<<"* PAY SLIP *"<<endl;
cout<<"**************************************************"<<endl<<endl;
cout<<"\n\nOverall Hours work: "<<overallhour;
cout<<"\nRate Per Day: "<<perday;
cout<<"\nRate per Hour: "<<perhour;
cout<<"\n\n * * Deductions * *";
cout<<"\nSSS : "<<sss;
cout<<"\nPag-Ibig : "<<pagibig;
cout<<"\nPhilHealth : "<<philhealth;
cout<<"\nCash Advance : "<<ca;
cout<<"\nTotal Deductions: "<<total_deduction;
cout<<"\n\n * * Net * *";
cout<<"\nGross Salary: "<<gross;
cout<<"\nNet Salary: "<<net;
}
return 0;
}
Compute the payroll of the 1 week DTR of the employee Level 1 no CA.