C Program to Calculate Bonus, Commission and Gross Salary
In this article, we will explain you, How to write a C Program to Calculate Bonus, Commission and Gross Salary of an Employee with an example.
Every company have some norms to calculate Bonus, Commission and Gross Salary for every sales person. For below example product manufacturing company has the following monthly compensation policy to their salespersons to increase the sales figures, we can declare Minimum base salary : 1500.00, Bonus for every product sold 200.00 and Commission on the total monthly sales : 2 per cent as per company policy.
C Program to Calculate Bonus, Commission and Gross Salary
Since the prices of products are changing, the sales price of each product is fixed at the beginning of every month. A program to compute a salesman gross salary is given.
#define BASE_SALARY 1500.00 #define BONUS_RATE 200.00 #define COMMISSION 0.02 main() { int quantity ; float gross_salary, price ; float bonus, commission ; printf("Input number sold and price\n") ; scanf("%d %f", &quantity, &price) ; bonus = BONUS_RATE * quantity ; commission = COMMISSION * quantity * price ; gross_salary = BASE_SALARY + bonus + commission ; printf("\n"); printf("Bonus = %6.2f\n", bonus) ; printf("Commission = %6.2f\n", commission) ; printf("Gross salary = %6.2f\n", gross_salary) ; }
Output
Input number sold and price 5 20450.00 Bonus = 1000.00 Commission = 2045.00 Gross salary = 4545.00
The above given the base salary, bonus, and commission rate, the inputs necessary to calculate the gross salary is, the price of each computer and the number sold during the month.
The gross salary is given by the equation:
Gross salary = base salary + (quantity * bonus rate) + (quantity * Price) * commission rate
Also read : C Tutorial – Learn C Programming Language Tutorial