Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

C.

PROGRAM

#include <stdio.h>
#include <conio.h>
#include <math.h>

int main()
{
char pcode, scode, enam[50];
int enumber;
float hoursworked,rate,gp1,gp2,overtime,overtimerate,overtimepay;
float med,sss,withholdingtax,insurance,totaldeduction,netpay;

clrscr();
printf("Enter EMPLOYEE NO:");
scanf("%d",&enumber);
printf("Enter EMPLOYEE NAME:");
scanf("%s",&enam);
printf("Enter STATUS CODE:");
scanf("%s",&scode);
printf("Enter POSITION CODE:");
scanf("%s",&pcode);
printf("Enter NO. OF HOURS WORKED:");
scanf("%f",&hoursworked);
printf("Enter RATE PER HOUR:");
scanf("%f",&rate);
clrscr();

gp1=hoursworked*rate;
overtimerate= (rate*(2.5));
overtime= (hoursworked-8);
overtimepay=(overtime*overtimerate);
gp2=(8*rate)+((overtime)*overtimerate);

gotoxy(35,2);
printf("XOXO COMPANY");
gotoxy(36,3);
printf("Cebu City");

gotoxy(28,5);
printf("***** P A Y S L I P *****");

gotoxy(1,7);
printf("EMPLOYEE NO.: %d",enumber);
gotoxy(1,8);
printf("EMPLOYEE NAME: %s",enam);

{gotoxy(1,9);
if(pcode=='A'||pcode=='a')
{printf("POSITION: General Manager");}
else if(pcode=='B'||pcode=='b')
{printf("POSITION: Department Head");}
else if(pcode=='C'||pcode=='c')
{printf("POSITION: Officer in Charge");}
else if(pcode=='D'||pcode=='d')
{printf("POSITION:Supervisor ");}
else if(pcode=='E'||pcode=='e')
{printf("POSITION: Team Leader");}
else if(pcode=='F'||pcode=='f')
{printf("POSITION: Production Team Worker");}
else
{printf("Invalid");}
}

{gotoxy(52,7);
if (scode=='s'||scode=='S')
{printf("STATUS: Single");
if(overtime<=0)
{ withholdingtax=gp1*(0.05);
insurance=gp1*(0.02);}
else
{ withholdingtax=gp2*(0.05);
insurance=gp2*(0.02);}
}
else if (scode=='m'||scode=='M')
{printf("STATUS: Married");
if(overtime<=0)
{ withholdingtax=gp1*(0.02);
insurance=gp1*(0.05);}
else
{ withholdingtax=gp2*(0.02);
insurance=gp2*(0.05);}
}
else if (scode=='h'||scode=='H')
{printf("STATUS: Head of the Family");
if(overtime<=0)
{ withholdingtax=gp1*(0.03);
insurance=gp1*(0.03);}
else
{ withholdingtax=gp2*(0.03);
insurance=gp2*(0.03);}
}
else
{printf("STATUS: Invalid");}
}

gotoxy(52, 8);
{printf("NO. OF HOURS WORKED:%.2f",hoursworked);}

gotoxy(1,11);
{printf("RATE PER HOUR: %.2f",rate);}
gotoxy(1,12);
{ if(overtime<=0)
{printf("OVERTIME PAY: 0");}
else
{printf("OVERTIME PAY: %.2f",overtimepay);}
}
gotoxy(1,13);
{if (overtime<=0)
{printf("GROSS PAY: %.2f",gp1);
if(gp1<3000)
{ sss=gp1*(0.05);
med=50;}
if(gp1>=3000&&gp1<5000)
{ sss=gp1*(0.08);
med=100;}
if(gp1>=5000&&gp1<10000)
{ sss=gp1*(0.12);
med=150;}
if(gp1>=10000&&gp1<15000)
{ sss=gp1*(0.15);
med=200;}
if(gp1>=15000&&gp1<20000)
{ sss=gp1*(0.18);
med=250;}
if(gp1>=20000)
{ sss=gp1*(0.2);
med=300;}
}

else
{printf("GROSS PAY: %.2f",gp2);
if(gp2<3000)
{ sss=gp2*(0.05);
med=50;}
if(gp2>=3000&&gp2<5000)
{ sss=gp2*(0.08);
med=100;}
if(gp2>=5000&&gp2<10000)
{ sss=gp2*(0.12);
med=150;}
if(gp2>=10000&&gp2<15000)
{ sss=gp2*(0.15);
med=200;}
if(gp2>=15000&&gp2<20000)
{ sss=gp2*(0.18);
med=250;}
if(gp2>=20000)
{ sss=gp2*(0.2);
med=300;}
}

gotoxy(1,15);
{printf("DEDUCTION");
gotoxy(1,16);
{printf("1.Withholding Tax: %.2f",withholdingtax);}
gotoxy(1,17);
{printf("2.SSS: %.2f",sss);}
gotoxy(1,18);
{printf("3.Med: %.2f",med);}
gotoxy(1,19);
{printf("4.Insurance: %.2f",insurance);}
gotoxy(1,20);
{ totaldeduction=med+sss+withholdingtax+insurance;
printf("TOTAL DEDUCTIONS: %.2f",totaldeduction);}
gotoxy(1,22);
{ if(overtime<=0)
{netpay=gp1-totaldeduction;}
else
{netpay=gp2-totaldeduction;}
printf("NET PAY: %.2f",netpay);
}
}
getch();
}
}

OUTPUTS
1.

2.

You might also like