#include main() { int eno; char enam[20],sc,pc,s,p; float nhw,rph,gp,ot,sss,med,wtax,ins,td,np; clrscr(); printf("Enter EMPLOYEE NO.:"); scanf("%d",&eno); print("Enter EMPLOYEE NAME:"); scanf("%s",&enam); printf("Enter STATUS CODE:"); sc=getche(); printf("\nEnter POSITION CODE:"); pc=getche(); printf("\nEnter NO. OF HRS. WORKED:"); scanf("%f",&nhw); printf("\nEnter RATE PER HOUR:"); scanf("%f",&rph); clrscr(); gotoxy(38,2); printf("ABC Company"); gotoxy(39,3); printf("Cebu City"); gotoxy(35,6); printf("*** PAY SLIP ***"); gotoxy(10,9); printf("EMPLOYEE NO. : %D",eno); s=toupper(sc); switch(s){ case 'S' : gotoxy(50,9); printf("STATUS: Single"); break; case 'M' : gotoxy(50,9); printf("STATUS: Married"); break; case 'H' : gotoxy(10,11); printf("POSITION: Department Head"); break; case 'C' : gotoxy(10,11); printf("POSITION: Officer in Charge"); break; defualt : gotoxy(10,11); printf("STATUS : Invalid Code"); break; } gotoxy(10,13); printf("RATE PER HOUR : %.2f",rph); gotoxy(10,14); printf("OVER TIME PAY : %.2f",ot); gotoxy(10,15); printf("GROSS PAY : %.2f",gp); gotoxy(10,17); printf("DEDUCTIONS"); gotoxy(10,18); printf("1.Withholding tax : %.2f",wtax); gotoxy(10,19); printf("2.SSS : %.2f",sss); gotoxy(10,20); printf("3.Med : %.2f",med); gotoxy(10,21); printf("4.Insurance : %.2f",ins); gotoxy(10,22); printf("TOTAL DEDUCTIONS : %.2f",td); gotoxy(10,24); printf("NET PAY : %2.f",np); getch(); }
please can you check check my code? c++(turboC)
#include<stdio.h>
main()
{
int eno;
char enam[20],sc,pc,s,p;
float nhw,rph,gp,ot,sss,med,wtax,ins,td,np;
clrscr();
printf("Enter EMPLOYEE NO.:");
scanf("%d",&eno);
print("Enter EMPLOYEE NAME:");
scanf("%s",&enam);
printf("Enter STATUS CODE:");
sc=getche();
printf("\nEnter POSITION CODE:");
pc=getche();
printf("\nEnter NO. OF HRS. WORKED:");
scanf("%f",&nhw);
printf("\nEnter RATE PER HOUR:");
scanf("%f",&rph);
clrscr();
gotoxy(38,2);
printf("ABC Company");
gotoxy(39,3);
printf("Cebu City");
gotoxy(35,6);
printf("*** PAY SLIP ***");
gotoxy(10,9);
printf("EMPLOYEE NO. : %D",eno);
s=toupper(sc);
switch(s){
case 'S' : gotoxy(50,9);
printf("STATUS: Single");
break;
case 'M' : gotoxy(50,9);
printf("STATUS: Married");
break;
case 'H' : gotoxy(10,11);
printf("POSITION: Department Head");
break;
case 'C' : gotoxy(10,11);
printf("POSITION: Officer in Charge");
break;
defualt : gotoxy(10,11);
printf("STATUS : Invalid Code");
break;
}
gotoxy(10,13);
printf("RATE PER HOUR : %.2f",rph);
gotoxy(10,14);
printf("OVER TIME PAY : %.2f",ot);
gotoxy(10,15);
printf("GROSS PAY : %.2f",gp);
gotoxy(10,17);
printf("DEDUCTIONS");
gotoxy(10,18);
printf("1.Withholding tax : %.2f",wtax);
gotoxy(10,19);
printf("2.SSS : %.2f",sss);
gotoxy(10,20);
printf("3.Med : %.2f",med);
gotoxy(10,21);
printf("4.Insurance : %.2f",ins);
gotoxy(10,22);
printf("TOTAL DEDUCTIONS : %.2f",td);
gotoxy(10,24);
printf("NET PAY : %2.f",np);
getch();
}
Step by step
Solved in 2 steps