#include <iostream>
#include <string.h>
using namespace std;
class Employee
{
public:
string Emp_Name;
int Join_Year;
int Emp_age;
int Emp_id;
public:
void Accept()
{
cout<<"Enter Employee ID : "<<endl;
cin>>Emp_id;
cout<<"Enter Employee name : "<<endl;
cin>>Emp_Name;
cout<<"Enter Employee age : "<<endl;
cin>>Emp_age;
cout<<"Enter Employee join Year : "<<endl;
cin>>Join_Year;
}
void Display_Emp_detail()
{
cout<<"Employee ID : "<<Emp_id<<endl;
cout<<"Employee name : "<<Emp_Name<<endl;
cout<<"Employee age : "<<Emp_age<<endl;
cout<<"Employee join Year : "<<Join_Year<<endl;
}
};
class Admin : public Employee
{
protected:
double Emp_Basic_Salary;
int Emp_OT_Hour;
float Emp_OT;
float Emp_Overtime_Pay , Emp_Tax_Rate;
float Emp_Gross_Pay , Emp_Net_Pay;
float Emp_Annual_Pay;
int Total_Exp;
int Emp_leave;
public:
void Accept1()
{
Accept();
cout<<"Enter Monthly salary : ";
cin>>Emp_Basic_Salary;
cout<<"Enter Over Time in hours : ";
cin>>Emp_OT_Hour;
cout<<"Enter Absenties : ";
cin>>Emp_leave;
}
void Overtime_Pay();
void Tax_Rate();
void Pay_Grade();
void Emp_Payment();
void Emp_Yearly_Payment();
void Emp_Experience_Count();
void Emp_Retire_Year();
void Emp_Leave_Pay();
};
void Admin :: Overtime_Pay()
{
Emp_OT = Emp_Basic_Salary * .01;
Emp_Overtime_Pay = Emp_OT_Hour * Emp_OT;
cout<<"Overtime Money is : "<<Emp_Overtime_Pay<<endl;
}
void Admin :: Tax_Rate()
{
if(Emp_Basic_Salary < 10000)
{
Emp_Tax_Rate = Emp_Basic_Salary * .05; // .05 means 5%
cout<<"Withholding Tax :"<<Emp_Tax_Rate<<endl;
}
if(Emp_Basic_Salary >= 10000 && Emp_Basic_Salary <= 20000)
{
Emp_Tax_Rate = Emp_Basic_Salary * .10; // .10 means 10%
cout<<"Withholding Tax :"<<Emp_Tax_Rate<<endl;
}
else if(Emp_Basic_Salary >= 20000 && Emp_Basic_Salary <=30000)
{
Emp_Tax_Rate = Emp_Basic_Salary * .15;
cout<<"Withholding Tax :"<<Emp_Tax_Rate<<endl;
}
else if(Emp_Basic_Salary >= 30000 && Emp_Basic_Salary <= 40000)
{
Emp_Tax_Rate = Emp_Basic_Salary * .20;
cout<<"Withholding Tax :"<<Emp_Tax_Rate<<endl;
}
else if(Emp_Basic_Salary >= 40000 && Emp_Basic_Salary <= 50000)
{
Emp_Tax_Rate = Emp_Basic_Salary * .25;
cout<<"Withholding Tax : "<<Emp_Tax_Rate<<endl;
}
else if(Emp_Basic_Salary > 50000)
{
Emp_Tax_Rate = Emp_Basic_Salary * .30;
cout<<"Withholding Tax : "<<Emp_Tax_Rate<<endl;
}
}
void Admin :: Pay_Grade()
{
if(Emp_Basic_Salary <= 10000)
{
cout << "Employee Pay Grade is "<<"F" << endl;
}
else if(Emp_Basic_Salary >= 10001 && Emp_Basic_Salary <= 20000)
{
cout << "Employee Pay Grade is " << "E" << endl;
}
else if(Emp_Basic_Salary >= 20001 && Emp_Basic_Salary <=30000)
{
cout << "Employee Pay Grade is " << "D" << endl;
}
else if(Emp_Basic_Salary >= 30001 && Emp_Basic_Salary <= 40000)
{
cout << "Employee Pay Grade is " << "C" << endl;
}
else if(Emp_Basic_Salary >= 40001 && Emp_Basic_Salary <= 50000)
{
cout << "Employee Pay Grade is " << "B" << endl;
}
else
{
cout << "Employee Pay Grade is " << "A" << endl;
}
}
void Admin :: Emp_Payment()
{
Emp_Gross_Pay = Emp_Basic_Salary + Emp_Overtime_Pay;
Emp_Net_Pay = Emp_Gross_Pay - Emp_Tax_Rate;
cout<<"Gross Payment : "<<Emp_Gross_Pay<<endl; //Without Tex Payment
cout<<"Net Payment : "<<Emp_Net_Pay<<endl;
}
void Admin :: Emp_Yearly_Payment()
{
Emp_Annual_Pay = 12 * Emp_Basic_Salary;
cout<<"Annual Income : "<<Emp_Annual_Pay<<endl;
}
void Admin::Emp_Experience_Count()
{
Total_Exp = 2020 - Join_Year;
cout<<"Total work experience:"<< Total_Exp <<" years" <<endl;
}
void Admin :: Emp_Retire_Year()
{
if(Emp_age<60)
{
int Remaining_year=60-Emp_age;
cout<<endl<<"Employee remaining year : "<<Remaining_year<<endl;
}
else
{
cout<<endl<<" Employee retired "<<endl;
}
}
void Admin :: Emp_Leave_Pay()
{
float Payment_with_leave,Leave;
Leave = Emp_Basic_Salary * .01;
Payment_with_leave = Emp_leave * Leave;
cout<<"Absents Salary cut : "<< Payment_with_leave<<endl;
}
int main()
{
Admin emp;
// emp.Accept();
emp.Accept1();
emp.Display_Emp_detail();
cout<<"\n-----------------------------------------------"<<endl;
//PayRoll emp(name ,Emp_age, OTHour , BasicSalary , JoinYear , Leaves);
cout<<"\n------------------------------------------------"<<endl;
emp.Overtime_Pay();
cout<<"\n------------------------------------------------"<<endl;
emp.Emp_Leave_Pay();
cout<<"\n*****************"<<endl;
emp.Pay_Grade();
cout<<"\n------------------------------------------------"<<endl;
emp.Tax_Rate();
cout<<"\n------------------------------------------------"<<endl;
emp.Emp_Payment();
cout<<"\n------------------------------------------------"<<endl;
emp.Emp_Yearly_Payment();
cout<<"\n------------------------------------------------"<<endl;
emp.Emp_Experience_Count();
cout<<"\n------------------------------------------------"<<endl;
emp.Emp_Retire_Year();
return 0;
}