基本信息
源码名称:c++ 职工工资系统(入门级控制台示例)
源码大小:1.69KB
文件格式:.cpp
开发语言:C/C++
更新时间:2020-05-04
友情提示:(无需注册或充值,赞助后即可获取资源下载链接)
嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300
本次赞助数额为: 2 元×
微信扫码支付:2 元
×
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
源码介绍
职工公司系统
class staff
{
public:
staff(double bSalary)
{
basicSalary = bSalary;
}
virtual void input() = 0;
virtual void output() = 0;
protected:
char name[30];
double basicSalary;
};
class teacher : public staff
{
public:
teacher(int basicsalary = 3000) : staff(basicsalary) { }
void input()
{
cout << "姓名?";
cin >> name;
cout << "职称 1,教授 2,副教授 3,讲师 (输入1,2或3):";
cin >> title;
cout << "课时?";
cin >> coursetime;
}
void output()
{
double salary;
switch (title)
{
case 1: salary = basicSalary coursetime * 50; break;
case 2: salary = basicSalary coursetime * 30; break;
case 3: salary = basicSalary coursetime * 20;
}
cout << "姓名:" << name << "\t本月工资:" << salary << endl;
}
protected:
int coursetime;
int title;
};
class manage : public staff
{
public:
manage(int basicsalary = 2500) : staff(basicsalary) { }
void input()
{
cout << "姓名?";
cin >> name;
cout << "职务工资?";
cin >> jobSalary;
}
void output()
{
double salary;
salary = basicSalary jobSalary;
cout << "姓名:" << name << "\t本月工资:" << salary << endl;
}
protected:
double jobSalary;
};
class technician : public staff
{
public:
technician(int basicsalary = 2000) : staff(basicsalary) { }
void input()
{
cout << "姓名?";
cin >> name;
cout << "工作日?";
cin >> workdays;
}
void output()
{
double salary;
salary = basicSalary workdays * 20;
cout << "姓名:" << name << "\t本月工资:" << salary << endl;
}
protected:
int workdays;
};
int main()
{
teacher t;
t.input();
t.output();
manage m;
m.input();
m.output();
technician h;
h.input();
h.output();
system("pause");
}
职工公司系统
class staff
{
public:
staff(double bSalary)
{
basicSalary = bSalary;
}
virtual void input() = 0;
virtual void output() = 0;
protected:
char name[30];
double basicSalary;
};
class teacher : public staff
{
public:
teacher(int basicsalary = 3000) : staff(basicsalary) { }
void input()
{
cout << "姓名?";
cin >> name;
cout << "职称 1,教授 2,副教授 3,讲师 (输入1,2或3):";
cin >> title;
cout << "课时?";
cin >> coursetime;
}
void output()
{
double salary;
switch (title)
{
case 1: salary = basicSalary coursetime * 50; break;
case 2: salary = basicSalary coursetime * 30; break;
case 3: salary = basicSalary coursetime * 20;
}
cout << "姓名:" << name << "\t本月工资:" << salary << endl;
}
protected:
int coursetime;
int title;
};
class manage : public staff
{
public:
manage(int basicsalary = 2500) : staff(basicsalary) { }
void input()
{
cout << "姓名?";
cin >> name;
cout << "职务工资?";
cin >> jobSalary;
}
void output()
{
double salary;
salary = basicSalary jobSalary;
cout << "姓名:" << name << "\t本月工资:" << salary << endl;
}
protected:
double jobSalary;
};
class technician : public staff
{
public:
technician(int basicsalary = 2000) : staff(basicsalary) { }
void input()
{
cout << "姓名?";
cin >> name;
cout << "工作日?";
cin >> workdays;
}
void output()
{
double salary;
salary = basicSalary workdays * 20;
cout << "姓名:" << name << "\t本月工资:" << salary << endl;
}
protected:
int workdays;
};
int main()
{
teacher t;
t.input();
t.output();
manage m;
m.input();
m.output();
technician h;
h.input();
h.output();
system("pause");
}