Answer to Question #288749 in C for Mohamed faizal

Question #288749

n an organization they decide to give bonus to all the employees on New Year. A 5%



bonus on salary is given to the grade A workers and 10% bonus on salary to the grade



B workers. Write a program to enter the salary and grade of the employee. If the



salary of the employee is less than $10,000 then the employee gets an extra 2% bonus



on salary Calculate the bonus that has to be given to the employee and print the salary

1
Expert's answer
2022-01-20T01:45:49-0500
#include<conio.h>
#include<stdio.h>
#include<stdlib.h>


/*
	In an organization they decide to give bonus to all the employees on New Year. A 5%
	bonus on salary is given to the grade A workers and 10% bonus on salary to the grade
	B workers. Write a program to enter the salary and grade of the employee. If the
	salary of the employee is less than $10,000 then the employee gets an extra 2% bonus
	on salary Calculate the bonus that has to be given to the employee and print the salary
*/


#define NO_OF_EMP	3
int main()
{
	float Salary[NO_OF_EMP],Bonus[NO_OF_EMP],BonGiven[NO_OF_EMP],TotalBonus=0,TotSal;
	char Grade[NO_OF_EMP];
	int Flag=1,n=0;
	
	while(n<NO_OF_EMP)
	{
		printf("\n\tEnter Employee #%d Grade (A or B): ",n+1); scanf("%c",&Grade[n]);
		printf("\n\tEnter Employee Salary            : "); scanf("%f",&Salary[n]);
		if(Grade[n]=='a' || Grade[n] == 'A') Bonus[n] = 5;
		if(Grade[n]=='b' || Grade[n] == 'B') Bonus[n] = 10;
		if(Salary[n]<=10000) Bonus[n] = 2;
		BonGiven[n] = Salary[n]*Bonus[n]/100;
		TotalBonus = TotalBonus+BonGiven[n];
		n++;		
	}
	
	for(n=0;n<NO_OF_EMP;n++)
	{
		TotSal = Salary[n]+BonGiven[n];
		printf("\n\tGrade: %c\tSalary: %.2f\tBonus: %6.2f\tTotal Salary: %6.2f",Grade[n],Salary[n],BonGiven[n],TotSal);
	}
	return(0);
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS