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