Problem G: 薪酬计算
Description
Input
Output
Sample Input
Sample Output
#include <iostream>
#include <iomanip>
#include <string.h>
#include <string>
using namespace std;
class Person{public:string pos;string name;int base;Person(string s):name(s){}virtual void input()=0;virtual void show()=0;virtual int pay()=0;
};
class Manager:public Person{public:int year_base;Manager(string s):Person(s){}void show(){cout<<name<<" (Manager)";}void input(){ cin>>year_base; }int pay(){return year_base*1000;}
};
class Employee:public Person{public:int month_base;int k;Employee(string s):Person(s){}void show(){cout<<name<<" (Employee)";}void input(){ cin>>month_base>>k; }int pay(){return month_base*1000*(12+k);}
};
class HourlyWorker:public Person{public:int hour_base;int k;HourlyWorker(string s):Person(s){}void show(){cout<<name<<" (HourlyWorker)";}void input(){ cin>>hour_base>>k; }int pay(){return hour_base*k;}
};
class CommWorker:public Person{public:int month_base;int k;CommWorker(string s):Person(s){}void show(){cout<<name<<" (CommWorker)";}void input(){ cin>>month_base>>k; }int pay(){return month_base*1000*12+20*k;}
};
int main()
{Person *person;string name, job;int cases;cin >> cases;for(int i = 1; i <= cases; ++i){cin >> job >> name;if(job == "Manager")person = new Manager(name);if(job == "Employee")person = new Employee(name);if(job == "HourlyWorker")person = new HourlyWorker(name);if(job == "CommWorker")person = new CommWorker(name);person->input();person->show();cout << " Annual Salary is " << person->pay() << "." << endl;}}
Problem G: 薪酬计算相关推荐
- Problem B: 薪酬计算
Problem B: 薪酬计算 Time Limit: 3 Sec Memory Limit: 128 MB Submit: 3366 Solved: 1937 [Submit][Status][ ...
- Problem E: 薪酬计算
Problem E: 薪酬计算 Time Limit: 3 Sec Memory Limit: 128 MB Submit: 3497 Solved: 2007 [Submit][Status] De ...
- Problem A: 薪酬计算
Description 某公司有经理(Manager).雇员(Employee).小时工(HourlyWorker)和营销人员(CommWorker)四类员工(Person),他们的薪酬计算方法各不一 ...
- Problem B: 薪酬计算 之二
Description 某公司有经理(Manager).销售(Sales).销售经理(SalesManager)四类雇员(Employee),他们的薪酬计算方法各不一样: 每个雇员(Employee) ...
- Problem M: 薪酬计算 之二
Description 某公司有经理(Manager).销售(Sales).销售经理(SalesManager)四类雇员(Employee),他们的薪酬计算方法各不一样: 每个雇员(Employee) ...
- 第 2 届河北省大学生程序设计竞赛(河北省赛)-Problem G. 520-题解
传送门 Problem A. Mex Query Problem B. Nim Game Problem C. icebound 的账单 Problem G. 520 Problem H. 神殿 Pr ...
- Problem G: 货币兑换
Problem G: 货币兑换 Time Limit: 1 Sec Memory Limit: 2 MB Submit: 14369 Solved: 6327 [Submit][Status][W ...
- Western Subregional of NEERC, Minsk, Wednesday, November 4, 2015 Problem G. k-palindrome dp
Problem G. k-palindrome 题目连接: http://opentrains.snarknews.info/~ejudge/team.cgi?SID=c75360ed7f2c7022 ...
- Problem G. Pandaria(线段树合并 + Kruskal 重构树)
Problem G. Pandaria 给定一个有nnn条边的无向连通图,每条边有对应的边权,每个点有一个颜色, 问从一个点出发,经过不超过www的边权,所能到达的点中,颜色出现次数做多且颜色编号最小 ...
最新文章
- Codeforces 894.D Ralph And His Tour in Binary Country
- zookeeper 分布式计数器
- php 提交网页 传值 获取编辑框的值
- python 常见内置函数setattr、getattr、delattr、setitem、getitem、delitem
- even though storm
- Poj1995--Raising Modulo Numbers(快速幂)
- 谈论 NOD32: 教育网超级 病毒更新服务器: http://222.197.166.33/main.htm
- Python:检查‘Dictionary‘是否为空似乎不起作用
- 20191222每日一句
- Python开胃菜(1):搭建开发环境
- mybatis代码自动生成工具-MyBatis Generator
- linux simg2img,simg2img工具
- omnet++tictoc12案例解析
- python猜词游戏演讲ppt_Python 猜词游戏–多步骤猜词+评分系统
- 【产品经理】AARRR模型
- 基于Gensim创建词向量
- 博士申请 | 新加坡南洋理工大学尹旬元老师招收机器学习方向全奖博士/博后
- 台湾印象: 太平洋的风
- 分布式数据库:如何正确选择分片键?
- 前端、vue、Vue3弹幕实现;前端CSS实现弹幕