Thursday, February 12, 2009

Exercise 4

Output



#include
#include

void main(){
clrscr();
int salary,years,bonus,sum;
printf("\n\tEnter employee Salary here:");
scanf("%d",&salary);

printf("\n\tEnter years:");
scanf("%d",&years);

switch(years){

case 1:
bonus=0.10*salary;
sum=salary+bonus;
printf("\n\tEmployee bonus is \"P%d",bonus);
printf("\n\nEmployee will receive a salary of \"P%d\"",sum);
break;
case 2:
bonus=0.20*salary;
sum=salary+bonus;
printf("\n\tEmployee bonus is \"P%d",bonus);
printf("\n\nEmployee will receive a salary of \"P%d\"",sum);
break;
case 3:
bonus=0.20*salary;
sum=salary+bonus;
printf("\n\tEmployee bonus is \"P%d",bonus);
printf("\n\nEmployee will receive a salary of \"P%d\"",sum);
break;
case 4:
bonus=0.10*salary;
sum=salary+bonus;
printf("\n\tEmployee bonus is \"P%d",bonus);
printf("\n\nEmployee will receive a salary of \"P%d\"",sum);
break;
case 5:
bonus=0.50*salary;
sum=salary+bonus;
printf("\n\tEmployee bonus is \"P%d",bonus);
printf("\n\nEmployee will receive a salary of \"P%d\"",sum);
break;
case 6:
bonus=0.50*salary;
sum=salary+bonus;
printf("\n\tEmployee bonus is \"P%d",bonus);
printf("\n\nEmployee will receive a salary of \"P%d\"",sum);
break;

case 7:
bonus=0.50*salary;
sum=salary+bonus;
printf("\n\tEmployee bonus is \"P%d",bonus);
printf("\n\nEmployee will receive a salary of \"P%d\"",sum);
break;
case 8:
bonus=0.50*salary;
sum=salary+bonus;
printf("\n\tEmployee bonus is \"P%d",bonus);
printf("\n\nEmployee will receive a salary of \"P%d\"",sum);
break;
case 9:
bonus=0.50*salary;
sum=salary+bonus;
printf("\n\tEmployee bonus is \"P%d",bonus);
printf("\n\nEmployee will receive a salary of \"P%d\"",sum);
break;

case 10:
bonus=0.50*salary;
sum=salary+bonus;
printf("\n\tEmployee bonus is \"P%d",bonus);
printf("\n\nEmployee will receive a salary of \"P%d\"",sum);
break;
}
if(years>=11)
{
bonus=0.75*salary;
sum=salary+bonus;
printf("\n\tEmployee bonus is \"P%d",bonus);
printf("\n\nEmployee will receive a salary of \"P%d\"",sum);
}
printf("\n\n\t\t\" GooD JoB! KeeP UP the GooD WorK!! \"");
printf("\n\n\n\t\t\t\t\t \"Lady\"");
printf("\n\t\t\t\t\t""Programmer""");
getch();
}

No comments: