0% found this document useful (0 votes)
59 views2 pages

Pre-Final Exam IN Computer Programming C++ Provided The C++ Payroll Code

This document provides the C++ code for a payroll program that calculates an employee's earnings and deductions over a 1-week period. It requests input of the employee's ID, level, name, and daily time-in and time-out. Based on the employee level, it calculates the daily and hourly rate. It totals the regular hours worked and computes the gross salary. It then lists the deductions for SSS, Pag-Ibig, and PhilHealth. Finally, it outputs the total deductions, gross salary, and net salary on the pay slip. The document instructs the user to run the program without any cash advances to compute the payroll for an employee at level 1.

Uploaded by

Dan James
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
59 views2 pages

Pre-Final Exam IN Computer Programming C++ Provided The C++ Payroll Code

This document provides the C++ code for a payroll program that calculates an employee's earnings and deductions over a 1-week period. It requests input of the employee's ID, level, name, and daily time-in and time-out. Based on the employee level, it calculates the daily and hourly rate. It totals the regular hours worked and computes the gross salary. It then lists the deductions for SSS, Pag-Ibig, and PhilHealth. Finally, it outputs the total deductions, gross salary, and net salary on the pay slip. The document instructs the user to run the program without any cash advances to compute the payroll for an employee at level 1.

Uploaded by

Dan James
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

PRE-FINAL EXAM

IN

COMPUTER PROGRAMMING C++

Provided the C++ Payroll Code

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.

Provide the following:

1. Rate per Day


2. Rate per Hour
3. Regular Hour
4. OT Hour
5. Holiday Hour
6. Late
7. Under Time
8. Total Deductions (Provide summary)
9. Gross Salary
10. Net Salary

Prepared by: Approved by:

Danielle James L. Cañete Jennifer O. Andres


I.T. Instructor School Director

You might also like