employee.hemployee(员工)的类声明头文件employee.cpp包含employee类的实现代码Salesman.hSalesman(售货员)的类声明头文件Salesman.cpp包含Salesman类的实现代码Warehouseman.hwarehouseman(库管员)的类声明头文件Warehouseman.cpp包含Warehouseman类的实现代码manager.hmanager(经理)的类声明头文件manager.cpp包含manager类的实现代码EmployeeList.hEmployeeList类(员工链表)的类声明头文件EmployeeList.cpp包含EmployeeList类的实现代码main.cpp主程序//****************************************//employee.h*//****************************************#ifndefH_EMPLOYEE#defineH_EMPLOYEEclassemployee//基类(员工){private:intnumber;//员工编号charAddress[100];//家庭地址protected:charname[30];//员工姓名floatfixedSalary;//固定工资floatMonthSalary;//月薪public:employee();//构造函数,录入员工个人信息voidShowInfor();//显示员工个人及工资信息voidRecordInfor(char*pInfBuffer);//将个人信息写入缓冲区//获得工作类别virtualchar*GetWorkStyle()=0;//计算员工工资的虚函数,因为只提供一个统一的接口,所以不需要添加任何实际的代码virtualvoidCountSalary()=0;};#endif//****************************************//employee.cpp*//****************************************#includeemployee.h#includeiostream.h#includestdio.h//构造函数,录入员工个人信息employee::employee(){coutendl;//录入员工姓名cout请输入员工姓名:;cinname;//录入员工编号cout请输入员工编号(1000-9999):;cinnumber;//检查员工编号,保证编号正确while(number1000||number9999){coutendl员工编号应为四位整数,请重新输入:;cinnumber;}//录入家庭地址cout请输入家庭地址:;cinAddress;//默认初始月薪为零MonthSalary=0.0;};//显示员工个人及工资信息voidemployee::ShowInfor(){coutendl;//显示员工姓名cout员工姓名:nameendl;//显示员工编号cout员工编号:numberendl;//显示家庭地址cout家庭地址:Addressendl;//显示工作类别cout工作类别:GetWorkStyle()endl;//显示月薪if(MonthSalary==0.0)cout月薪:尚未计算endl;elsecout月薪:MonthSalaryendl;};//将个人信息写入缓冲区voidemployee::RecordInfor(char*pInfBuffer){intj;j=sprintf(pInfBuffer,员工姓名:%s\r\n,name);j+=sprintf(pInfBuffer+j,员工编号:%d\r\n,number);j+=sprintf(pInfBuffer+j,家庭地址:%s\r\n,Address);j+=sprintf(pInfBuffer+j,工作类别:%s\r\n,GetWorkStyle());if(MonthSalary==0.0)j+=sprintf(pInfBuffer+j,月薪:尚未计算\r\n\r\n);elsej+=sprintf(pInfBuffer+j,月薪:%f\r\n\r\n,MonthSalary);}//****************************************//Salesman.h*//****************************************#ifndefH_SALESMAN#defineH_SALESMAN#includeemployee.h//售货员类classSalesman:publicemployee{private:floatsaleSum;//售货员的销售额floatgetRate;//售货员的提成比率public:Salesman();//构造函数,录入售货员个人信息char*GetWorkStyle();//获得工作类别voidCountSalary();//计算售货员的工资};#endif//****************************************//Salesman.cpp*//****************************************#includeSalesman.h#includeiostream.h//构造函数,录入售货员个人信息Salesman::Salesman(){coutendl;//录入售货员的固定月薪cout请输入售货员的固定月薪:;cinfixedSalary;//录入售货员的当月销售额cout请输入售货员的提成比率;cingetRate;}//获得工作类别char*Salesman::GetWorkStyle(){return售货员;}//计算售货员的工资voidSalesman::CountSalary(){//得到售货员的当月销售额cout请输入售货员name的当月销售额endl;cinsaleSum;//工资=固定工资+营业额×提成比率MonthSalary=fixedSalary+saleSum*getRate;}//****************************************//warehouseman.h*//****************************************#ifndefH_WAREHOUSEMAN#defineH_WAREHOUSEMAN#includeemployee.h//库管员类classWarehouseman:publicemployee{private:floatbonus;//库管员的奖金public:Warehouseman();//构造函数,录入库管员个人信息char*GetWorkStyle();//获得工作类别voidCountSalary();//计算库管员的工资};#endif//****************************************//warehouseman.cpp*//****************************************#includeWarehouseman.h#includeiostream.h//构造函数,录入库管员个人信息Warehouseman::Warehouseman(){coutendl;//录入库管员的固定月薪cout请输入库管员的固定月薪:;cinfixedSalary;}//获得工作类别char*Warehouseman::GetWorkStyle(){return库管员;}//计算库管员的工资voidWarehouseman::CountSalary(){//得到库管员的当月奖金cout请输入库管员name的当月奖金endl;cinbonus;//工资=固定工资+当月奖金MonthSalary=fixedSalary+bonus;}//****************************************//Manager.h*//****************************************#ifndefH_MANAGER#defineH_MANAGER#includeEmployee.h//经理类classManager:publicEmployee{private:floatOfficeExpense;//经理的办公费用public:Manager();//构造函数,录入经理个人信息char*GetWorkStyle();//获得工作类别voidCountSalary();//计算经理的工资};#endif//****************************************//Manager.cpp*//****************************************#includeManager.h#includeiostream.h//构造函数,录入经理个人信息Manager::Manager(){coutendl;//录入经理的固定月薪cout请输入经理的固定月薪:endl;cinfixedSalary;}//获得工作类别char*Manager::GetWorkStyle(){return经理;}//计算经理的工资voidManager::CountSalary(){//得到经理的当月办公费用cout请输入经理name的当月办公费用endl;cinOfficeExpense;//月薪=固定工资+当月办公费用MonthSalary=fixedSalary+OfficeExpense;}//****************************************//EmployeeList.h*//****************************************#ifndefH_EMPLOYEELIST#defineH_EMPLOYEELIST#includeemployee.h#defineNULL0//定义一个包含员工类对象的节点结构structemployeeNode{employee*pEmployee;employeeNode*pNext;};classEmployeeList{private:employeeNode*pEmpListRoot;//员工类对象的链表的根指针public:EmployeeList();//析构函数~EmployeeList();//将一个包含员工类对象的节点添加到链表中voidAddList(employee*pEmployee);//计算所有员工的月薪voidCaculateAllSalary();//显示所有员工的详细信息voidShowAllInfo();//将所有员工的详细信息保存到纪录文件上voidSaveAllRecord();};#endif//****************************************//EmployeeList.cpp*//****************************************#includeEmployeeList.h#includeiostream.h#includefstream.h#includestdio.h#includestring.hEmployeeList::EmployeeList(){pEmpListRoot=NULL;}//将一个包含员工类对象的节点添加到链表