#include <iostream>
#include <string>
using std::string
//---------------------------------------
static int SerialNumber = 1000 // 人员编号基数:1000
//---------------------------------------
class Employee
{
private:
Employee()
string name // 姓名
intserial// 工号
intlevel // 级别
float salary// 薪水
public:
Employee(const string sName)
{
name = sName
serial = SerialNumber + 1
level = 1
}
void setSerial(int iSerial)// 设置人员编号
{
serial = iSerial
}
void setLevel(int iLevel) // 设置人员级别
{
level = iLevel
}
void setPay(float iPay) // 设置人员薪水
{
salary = iPay
}
float printPay()
{
std::cout <<"员工:" <<name <<", 本月薪水:" <<salary <<std::endl
}
}
//---------------------------------------
class PartTime : public Employee
{
private :
float wage
float hours
public :
PartTime(const string sName)
: Employee(sName)
{
wage = 100.0 // 兼职人员的小时薪金
hours = 8.0 * 22// 兼职人员缺省每月工作小时数
}
void setWage(float wg)
{
wage = wg
}
void setHours(float hrs)
{
hours = hrs
}
float computePay()
{
setPay(wage * hours)
}
}
//---------------------------------------
class Salesman : public Employee
{
private:
Salesman()
float comm
float sale
public:
Salesman(const sting sName) : Employee(sName)
{
comm = 500
sale = 0.0
}
void setCommission(float fComm)
{
comm = fComm
}
void setSales(float fSale)
{
sale = fSale
}
float computePay()
{
setPay(comm * 0.04)
}
}
//---------------------------------------
class Manager : public Employee
{
private :
Manager()
public :
Manager(const string sName)
: Employee(sName)
{
}
void computePay(float fSalary)
{
setPay(8000.0 + fSalary)
}
}
//---------------------------------------
class SaleManager : public Employee
{
private :
SaleManager()
float basicsalary
float saleroom
public :
SaleManager(const string sName) : Employee(sName)
{
basicsalary = 5000.0
}
void setSaleroom(float fSaleroom)
{
saleroom = fSaleroom
}
float computePay()
{
setPay(basicsalary + saleroom * 0.005)
}
}
//---------------------------------------
int main(int argc, char *argv[])
{
Manager aManager("经理")
SaleManager aSaleManager("销售经理")
PartTimeaPartTime("兼职技术人员")
SalesmanaSales("兼职推销员")
aManager.computePay()
aSaleManager.computePay()
aPartTime.computePay()
aSales.computePay()
return 0
}
兼职做数据库系统管理员,不怎么值钱,因为sql server及MIS系统维护通常都很稳定,不怎么需要维护。
如果是资深的疑难问题,也许不错。普通的,能够每次200-500就不错了。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)