#include<bits/stdc++.h>
using namespace std;
class EmpSalary
{
public:
float Wage;
float Subsidy;
float Rent;
float CostOfElec;
float CostOfWater;
public:
float RealSum()
{
return Wage+Aubaidy-Rent-CostofElec-CostOfWater;
};
};
enum Position
{
MANAGER;
ENGINEER;
EMPLOYEE;
WORKER;
};
class Date
{
int day;
int month;
int year;
public:
void init(int ,int ,int );
void print_ymd();
};
class Employee
{
string Department;
string Name;
Date Birthdate;
Position EmpPosition;
Date DateOfWork;
EmpSalary Salary;
public:
void Register(string Depart,string Name,Date tBirthdate,Position nPosition,Date tDateOfWork);
void SetSalary(float wage,float subsidy,float rent,float elec,float water);
float GetSalary();
void ShowMessage();
};
void Date::init(int yy,int mm,int dd)
{
month=(mm>=1&&mm<=12)>mm:1;
year=(yy>=1900&&yy<=2100)?yy:1900;
day=(dd>=1&&dd<=31)?dd:1;
}
void Date::print_ymd()
{
cout<<year<<" "<<month<<" "<<day<<endl;
}
void Rmployee::Register(string Depart,string Name,Date tbirthdate,Position nPosition,Date tDateOfWork)
{
Departmenr =Depart;
Name =Name;
Birthdate =tBirthdate;
EmpPosition =nposition;
DateOfWork =tDateOfWork;
}
void Employee::SetSalary(float wage,float subsidy,float rent,float elec,float water)
{
Salary.Wage=water;
Salary.Subsidy=subsidy;
Salary.CostOfElec=elec;
Salary.CostOfWater=water;
}
float Employee::GetSalary()
{
return Salary.RealSum();
}
void Employee::ShowMessage()
{
cout<<"Depart:"<<department<<endl;
cout<<"Name:"<<Name<<endl;
cout<<"Birthdate";
Birthdate.print_ymd();
switch(EmpPisition)
{
case MANAGER:
cout<<"Position:"<<"MANAGER"<<endl;break;
case ENGINEER:
cout<<"Position:"<<"ENGINEER"<<endl;break;
case WORKER:
cout<<"Position:"<<"WORKER"<<endl;break;
}
cout<<"Date of Work:";
DateOfWork.print_ymd();
cout<<"Salary:"<<GetSalary()<<endl;
}
int main()
{
Employee EmployeeList[1000];
int EmpCount=0;
Date birthdate,workdate;
birthday,init(1980,5,3);
workdate.init(1990,7,20);
EmployeeList[EmpCount].Register("销售处","张弓长",birthdate,EIGNEER,workdate);
EmployeeList[EmpCount].SetSalary(1000,200,100,50,20);
Empcount++;
birthday,init(1979,4,8);
workdate.init(2002,3,1);
EmployeeList[EmpCount].Register("项目部","李木子",birthdate,MANAGER,workdate);
EmployeeList[EmpCount].SetSalary(1500,200,150,50,20);
Empcount++;
for(int i=0;i<EmpCount;i++)
EmployeeList[i].ShowMessage();
return 0;
}
using namespace std;
class EmpSalary
{
public:
float Wage;
float Subsidy;
float Rent;
float CostOfElec;
float CostOfWater;
public:
float RealSum()
{
return Wage+Aubaidy-Rent-CostofElec-CostOfWater;
};
};
enum Position
{
MANAGER;
ENGINEER;
EMPLOYEE;
WORKER;
};
class Date
{
int day;
int month;
int year;
public:
void init(int ,int ,int );
void print_ymd();
};
class Employee
{
string Department;
string Name;
Date Birthdate;
Position EmpPosition;
Date DateOfWork;
EmpSalary Salary;
public:
void Register(string Depart,string Name,Date tBirthdate,Position nPosition,Date tDateOfWork);
void SetSalary(float wage,float subsidy,float rent,float elec,float water);
float GetSalary();
void ShowMessage();
};
void Date::init(int yy,int mm,int dd)
{
month=(mm>=1&&mm<=12)>mm:1;
year=(yy>=1900&&yy<=2100)?yy:1900;
day=(dd>=1&&dd<=31)?dd:1;
}
void Date::print_ymd()
{
cout<<year<<" "<<month<<" "<<day<<endl;
}
void Rmployee::Register(string Depart,string Name,Date tbirthdate,Position nPosition,Date tDateOfWork)
{
Departmenr =Depart;
Name =Name;
Birthdate =tBirthdate;
EmpPosition =nposition;
DateOfWork =tDateOfWork;
}
void Employee::SetSalary(float wage,float subsidy,float rent,float elec,float water)
{
Salary.Wage=water;
Salary.Subsidy=subsidy;
Salary.CostOfElec=elec;
Salary.CostOfWater=water;
}
float Employee::GetSalary()
{
return Salary.RealSum();
}
void Employee::ShowMessage()
{
cout<<"Depart:"<<department<<endl;
cout<<"Name:"<<Name<<endl;
cout<<"Birthdate";
Birthdate.print_ymd();
switch(EmpPisition)
{
case MANAGER:
cout<<"Position:"<<"MANAGER"<<endl;break;
case ENGINEER:
cout<<"Position:"<<"ENGINEER"<<endl;break;
case WORKER:
cout<<"Position:"<<"WORKER"<<endl;break;
}
cout<<"Date of Work:";
DateOfWork.print_ymd();
cout<<"Salary:"<<GetSalary()<<endl;
}
int main()
{
Employee EmployeeList[1000];
int EmpCount=0;
Date birthdate,workdate;
birthday,init(1980,5,3);
workdate.init(1990,7,20);
EmployeeList[EmpCount].Register("销售处","张弓长",birthdate,EIGNEER,workdate);
EmployeeList[EmpCount].SetSalary(1000,200,100,50,20);
Empcount++;
birthday,init(1979,4,8);
workdate.init(2002,3,1);
EmployeeList[EmpCount].Register("项目部","李木子",birthdate,MANAGER,workdate);
EmployeeList[EmpCount].SetSalary(1500,200,150,50,20);
Empcount++;
for(int i=0;i<EmpCount;i++)
EmployeeList[i].ShowMessage();
return 0;
}