1. Program to read the data of `n` employees and compute the net salary of each employee (DA = 52% of basic and IT = 30% of the gross salary).
#include <iostream.h>
#include <conio.h>
class Employee {
public:
int empId;
char name[50];
float basicSalary;
void inputDetails() {
cout << "Enter employee ID: ";
cin >> empId;
cout << "Enter employee name: ";
cin.getline(name, 50);
cout << "Enter basic salary: ";
cin >> basicSalary;
}
void calculateNetSalary() {
float DA = 0.52 * basicSalary;
float grossSalary = basicSalary + DA;
float IT = 0.3 * grossSalary;
float netSalary = grossSalary - IT;
cout << "Net salary of employee " << empId << ": " << netSalary << endl;
}
};
int main() {
int n;
cout << "Enter the number of employees(less then 100): ";
cin >> n;
Employee employees[100];
for (int i = 0; i < n; i++) {
cout << "\nEnter details for employee " << i + 1 << endl;
employees[i].inputDetails();
employees[i].calculateNetSalary();
}
getch();
return 0;
}