#include<iostream>
using namespace std;
class Employee{
private:
string Employee_id, Employee_name, Position,Department;
double Basic_pay, Deductions;
public:
void Accept (){
cout<<"Enter employee id\n";
cin>>Employee_id;
cout<<"Enter employee name\n";
cin>>Employee_name;
cout<<"Enter employee Position\n";
cin>>Position;
cout<<"Enter employee Department\n";
cin>>Department;
cout<<"Enter employee Basic_pay\n";
cin>>Basic_pay;
cout<<"Enter employee Deductions\n";
cin>>Deductions;
}
double Total_salary(){
double Salary = Basic_pay + Basic_pay * 0.25 + Basic_pay * 0.12 + Basic_pay * 0.15 - Deductions;
return Salary;
}
void Display(){
cout<<"Employee id: "<<Employee_id<<endl;
cout<<"Employee name: "<<Employee_name<<endl;
cout<<"Employee Position: "<<Position<<endl;
cout<<"Employee Department: "<<Department<<endl;
cout<<"Employee Basic_pay: "<<Basic_pay<<endl;
cout<<"Employee Deductions: "<<Deductions<<endl;
cout<<"Employee Salary: "<<Total_salary()<<endl;
}
};
int main(){
Employee em;
em.Accept();
em.Display();
cout<<"Enter the number of employees:\n";
int n;
cin>>n;
Employee emp[n];
for(int i=0; i<n; i++){
emp[i].Accept();
}
for(int i=0; i<n; i++){
emp[i].Display();
}
}
Comments
Leave a comment