Sunday, February 15, 2009

Exercise no. 6

Exercise # 6:


#include
#include

void main(){
clrscr();
int salary,years,bonus,sum;
gotoxy(28,5);textcolor(LIGHTCYAN);cprintf("E X E R C I S E 6 / S A L A R Y");
gotoxy(24,6);textcolor(LIGHTCYAN);cprintf("\n\tEnter employees Salary here:");
scanf("%d",&salary);

gotoxy(24,7);textcolor(LIGHTRED);cprintf("\n\tEnter years:");
scanf("%d",&years);

switch(years){

case 1:
bonus=0.10*salary;
sum=salary+bonus;
gotoxy(24,8);textcolor(RED);cprintf("\n\tEmployee/s bonus is \"P%d",bonus);
gotoxy(24,9);textcolor(LIGHTBLUE);cprintf("\n\nEmployee/s will receive a salary of \"P%d\"",sum);
break;
case 2:
bonus=0.20*salary;
sum=salary+bonus;
gotoxy(24,8);textcolor(LIGHTBLUE);cprintf("\n\tEmployee/s bonus is \"P%d",bonus);
gotoxy(24,9);textcolor(YELLOW);cprintf("\n\nEmployee/s will receive a salary of \"P%d\"",sum);
break;
case 3:
bonus=0.20*salary;
sum=salary+bonus;
gotoxy(24,8);textcolor(LIGHTGREEN);cprintf("\n\tEmployee/s bonus is \"P%d",bonus);
gotoxy(24,9);textcolor(LIGHTCYAN);cprintf("\n\nEmployee/s will receive a salary of \"P%d\"",sum);
break;
case 4:
bonus=0.10*salary;
sum=salary+bonus;
gotoxy(24,8);textcolor(LIGHTBLUE);cprintf("\n\tEmployee/s bonus is \"P%d",bonus);
gotoxy(24,9);textcolor(LIGHTCYAN);cprintf("\n\nEmployee/s will receive a salary of \"P%d\"",sum);
break;
case 5:
bonus=0.50*salary;
sum=salary+bonus;
gotoxy(24,8);textcolor(LIGHTRED);cprintf("\n\tEmployee/s bonus is \"P%d",bonus);
gotoxy(24,9);textcolor(LIGHTBLUE);cprintf("\n\nEmployee/s will receive a salary of \"P%d\"",sum);
break;
case 6:
bonus=0.50*salary;
sum=salary+bonus;
gotoxy(24,8);textcolor(GREEN);cprintf("\n\tEmployee/s bonus is \"P%d",bonus);
gotoxy(24,9);textcolor(LIGHTCYAN);cprintf("\n\nEmployee/s will receive a salary of \"P%d\"",sum);
break;

case 7:
bonus=0.50*salary;
sum=salary+bonus;
gotoxy(25,8);textcolor(YELLOW);cprintf("\n\tEmployee/s bonus is \"P%d",bonus);
gotoxy(24,9);textcolor(LIGHTGREEN);cprintf("\n\nEmployee/s will receive a salary of \"P%d\"",sum);
break;
case 8:
bonus=0.50*salary;
sum=salary+bonus;
gotoxy(24,8);textcolor(LIGHTRED);cprintf("\n\tEmployee/s bonus is \"P%d",bonus);
gotoxy(24,9);textcolor(LIGHTGREEN);cprintf("\n\nEmployee/s will receive a salary of \"P%d\"",sum);
break;
case 9:
bonus=0.50*salary;
sum=salary+bonus;
gotoxy(24,8);textcolor(LIGHTBLUE);cprintf("\n\tEmployee/s bonus is \"P%d",bonus);
gotoxy(24,9);textcolor(DARKGRAY);cprintf("\n\nEmployee/s will receive a salary of \"P%d\"",sum);
break;

case 10:
bonus=0.50*salary;
sum=salary+bonus;
gotoxy(24,8);textcolor(LIGHTCYAN);cprintf("\n\tEmployee/s bonus is \"P%d",bonus);
gotoxy(24,9);textcolor(LIGHTBLUE);cprintf("\n\nEmployee/s will receive a salary of \"P%d\"",sum);
break;
}
if(years>=11)
{
bonus=0.75*salary;
sum=salary+bonus;
gotoxy(24,8);textcolor(LIGHTBLUE);cprintf("\n\tEmployee/s bonus is \"P%d",bonus);
gotoxy(24,9);textcolor(LIGHTGREEN);cprintf("\n\nEmployee/s will receive a salary of \"P%d\"",sum);
}
gotoxy(25,11);textcolor(WHITE);cprintf("\n\n\" GOOD JOB! KEEP UP THE GOOD WORK!!! \"");

getch();
}
OUTPUT:

No comments:

Post a Comment