Write a menu driven program using switch case to find the salary of an employee based on
the employee code as follows:
DA
PF
Tax
Employee Code
40% of BP
6% of BP
4.5% of BP+da
A
5% of BP
8.5% of BP
50% of BP
C
3% of (BP-PF)
45% of BP
7% of BP
D
Read the basic pay (BP) and the employee code of an employee at run-time using Scanner.
Calculate DA, PF and Tax accordingly. Finally print the net-pay (NP). Where net-pay
(NP)-BP-DA-(PF+Tax).
Answers
Answer:
hey buddy that's way you don't have to worry much now as I think you are from c language , a best language for basic fundamentals of coding
so here is your code :
#include <stdio.h>
//main program
int main()
{
//variable to store values
float basic, da, hra, ta, others;
float pf,it;
float net_salary;
//input required fields
printf("Enter Basic Salary ($): ");
scanf("%f",&basic);
printf("Enter HRA ($): ");
scanf("%f",&hra);
printf("Enter TA ($): ");
scanf("%f",&ta);
printf("Enter others ($): ");
scanf("%f",&others);
//calculate DA 12% of Basic Salary
da = (basic*12)/100;
//calculate PF 14% of Basic salary
pf = (basic*14)/100;
//calculate IT, 15% of Basic salary
it = (basic*15)/100;
//calculate net salary
net_salary = basic + da + hra + ta + others - (pf+it);
//printing Net salary
printf("Net Salary is: $ %.02f\n",net_salary);
return 0;
}