#include <iostream>
#include <string>
using namespace std;
class Employee {
private:
int emp_id;
string name;
float salary;
public:
// Function to accept employee details
void acceptDetails() {
cout << "Enter Employee ID: ";
cin >> emp_id;
cin.ignore(); // clear newline before getline
cout << "Enter Employee Name: ";
getline(cin, name);
cout << "Enter Employee Salary: ";
cin >> salary;
}
// Function to calculate net salary (after 10% tax)
float calculateNetSalary() {
return salary - (salary * 0.10f);
}
// Function to display employee details
void displayDetails() {
cout << "\nEmployee Details:\n";
cout << "ID: " << emp_id << endl;
cout << "Name: " << name << endl;
cout << "Gross Salary: " << salary << endl;
cout << "Net Salary (after 10% tax): " << calculateNetSalary() << endl;
}
};
int main() {
Employee emp;
emp.acceptDetails();
emp.displayDetails();
return 0;
}