Class Employee
Class Employee
String id;
String name;
String designation;
double basicSalary;
double da;
double hra;
double totalSalary;
Explanation:
1. Constructor: The constructor initializes the employee’s ID, name, designation, and basic
salary, then calls calculateSalary() to compute DA, HRA, and total salary.
2. calculateSalary(): This method calculates DA as 10% of the basic salary, HRA as 15% of the
basic salary, and then computes the total salary as the sum of the basic salary, DA, and
HRA.
3. display(): This method prints out all the employee details including ID, name, designation,
basic salary, DA, HRA, and total salary.