




已阅读5页,还剩19页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
暑假实习 公司职员信息管理 面向对象程序设计 公公司职员信息管理系统司职员信息管理系统 一 一 系统概要 系统概要 公司职员的信息管理程序主要实现以下功能 输入员工的姓名 输出该员工 的基本信息 级别以及当月工资信息 需求如下 1 某小型公司 主要由总经理 技术经理和技术人员 销售经理和销售人员 要求存 储所有人员的一下信息 姓名 性别 出生年月 技术特长 血型 星座 参加工作 时间 接入本公司时间 联系电话 编号 级别 当月薪 计算月薪总额并显示全部 信息 2 人员的编号从 开始 依次递增 3 程序对所有人员有提升级别的功能 假设所有人员的初始级别均为 级 然后进行 升级 总经理升为 级 技术经理和销售经理升为 级 技术人员升为 级 销售人 员为 级 4 月工资计算办法如下 总经理拿固定月薪 10000 元 技术经理拿固定月薪 6000 元加 奖金 技术人员拿固定月薪 3000 元加奖金 销售经理既拿固定月薪也领取销售提成 固 定月薪为 4000 元 销售提成为所辖部门的当月销售总额的 0 5 销售人员的 月薪按当月销售额的 提成 5 考核结果作为升级和工资提成的依据 考核结果按百分制计算 二 二 基本功能要求 基本功能要求 设计一个基类 employee 然后派生出 technician 技术人员 类 manager 经理 类和 salesman 销售人员 类共 3 类 在此基础上通过继承和派生实现其它类 职员信息要求保 存到文件 对部分数据应设置有操作权限 三 三 功能描述 功能描述 1 新进入公司员工基本信息的输入 2 公司员工基本信息的查询 修改 3 离开公司员工信息的处理 4 与员工级别有关的操作 5 与月薪有关的操作 6 与人员考核有关的操作 四 四 主要知识点 主要知识点 1 C 语言程序设计技术 特别是数组和指针的应用 2 面向对象程序设计技术 特别是继承和派生以及文件的操作 5 总体设计思路 总体设计思路 在最初拿到程序设计的要求时 我便有个明确的思路 由大化小 不管是多么复杂 多 么冗长的程序 都是有一个个小功能或者说是函数 指针组合而成的 当我把这个大程序分 解成其所需要的各个小功能进行编程时 这个公司职工管理系统就会明显地简单多了 正如 上图所示 在反复看了几遍要求之后 我把几个重要的信息或者对象用红色的字体标出 这 有助于我在编程时时刻提醒我还有哪些需要注意的 也助我理清了编程的思路 变成之前 应注意到本职工信息管理系统以 C 语言知识为基础 运用各种函数 文件 等方式实现录入职工信息并保存 显示所有职工信息 查询职工信息 职工信息修改并保存 删除职工信息 月薪总额管理 退出的功能 程序主要以函数调用及友元类的方式工作 菜 单功能在主函数中由 switch 语句实现 该程序一共用了 8 个函数 可以说函数是该程序的核 心与灵魂 这些函数分别是 1 Input 输入函数 可以实现员工信息的输入及存入文件 2 enlarge add 增加员工函数 3 delete 删除员工函数 4 alter change 修改员工函数 5 checkperson find 查询个人信息函数 6 save 保存函数 7 promote 升级函数 8 test 设定考核成绩函数 而 在编写功能函数之前 我先是将整个程序的对象做了个梳理 6 主程序 主程序 基类 基类 employee 销售人员类 销售人员类 salesman 技术人员类 技术人员类 technician 销售经理类 销售经理类 Tmanager 技术经理类 技术经理类 Smanager 总经理类 总经理类 manager 派派 生生 职工基本信息 姓名 性别 出生年月 技术特长 血型 星座 参加工作的时间 接入本 公司的时间 联系电话 级别 编号 月薪总合 1 首先 加上头文件 include include include using namespace std 全局数据 对象 double Managersalary 10000 总经理固定月薪 double Tmanagersalary 6000 技术经理固定月薪 double Smanagersalary 4000 销售经理固定月薪 double Techniciansalary 3000 技术人员固定月薪 int ID 0 员工编号 整个程序操作对象的基类 最初编写的部分 class Employee 基类 protected 以下为所需的职员基本信息的定义 int No 编号 char Name 20 姓名 char Sex 2 性别 char Blood 3 血型 char Birth 10 出生年月 char Tel 20 联系电话 char Technicial 20 技术特长 char Constellation 20 星座 int Duty char Timeofbegin 10 参加工作时间 char Timeofcome 10 接入本公司时间 int Grade 级别 double Earning 工资 月薪 Employee next 基类的指针 public Employee char ID int Grade char Name char Sex char Birth char Blood char Tel char Technicial char Constellation char Timeofbegin char Timeofcome int Duty this Duty Duty this Grade Grade strcpy this Name Name this No ID strcpy this Sex Sex strcpy this Birth Birth strcpy this Blood Blood strcpy this Tel Tel strcpy this Technicial Technicial strcpy this Constellation Constellation strcpy this Timeofbegin Timeofbegin strcpy this Timeofcome Timeofcome 指针的指向 virtual void Salary 0 virtual void Output 0 virtual void Output1 0 virtual void Output2 0 friend class Company 需基类 之后可能用到的 以下是五个派生类 也是公司已有的五个级别职员称谓 class Manager public Employee 1 派生经理类 public Manager char ID int Grade char Name char Sex char Birth char Blood char Tel char Technicial char Constellation char Timeofbegin char Timeofcome intDuty Employee ID Gr ade Name Sex Birth Blood Tel Technicial Constellation Timeofbegin Timeofcome Duty void Salary Earning Managersalary void Output Salary cout 编号 No t 级别 Grade t 姓名 Name t 性别 Sex t 血型 Blood t 出生 Birth t 联系电话 Tel t 特长 Technicial t 星座 Constellation t 开始工作时间 Timeofbegin t 加入 公司时间 Timeofcome t 经理 t 工资 Earning endl void Output1 Salary cout 编号 No t 级别 Grade t 姓名 Name t 经理 endl void Output2 Salary cout 编号 No t 级别 Grade t 姓名 Name t 经理 t 工资 Earning Workload Workload double GetWorkload return Workload void SetWorkload double Amount this Workload Amount void Salary Earning Smanagersalary Workload 0 005 void Output Salary cout 编号 No t 级别 Grade t 姓名 Name t 性别 Sex t 血型 Blood t 出生 Birth t 联系电话 Tel t 特长 Technicial t 星座 Constellation t 开始工作时间 Timeofbegin t 加入 公司时间 Timeofcome t 销售经理 t 工资 Earning endl void Output1 Salary cout 编号 No t 级别 Grade t 姓名 Name t 销售经理 endl void Output2 Salary cout 编号 No t 级别 Grade t 姓名 Name t 销售经理 t 工资 Earning Workload Workload double GetWorkload return Workload void SetWorkload double Amount this Workload Amount void Salary Earning Workload 0 01 void Output Salary cout 编号 No t 级别 Grade t 姓名 Name t 性别 Sex t 血型 Blood t 出生 Birth t 联系电话 Tel t 特长 Technicial t 星座 Constellation t 开始工作时间 Timeofbegin t 加入 公司时间 Timeofcome t 销售人员 t 工资 Earning endl void Output1 Salary cout 编号 No t 级别 Grade t 姓名 Name t 销售人员 endl void Output2 Salary cout 编号 No t 级别 Grade t 姓名 Name t 销售人员 t 工资 Earning Award Award double GetAward return Award void SetAward double Amount this Award Amount void Salary Earning Techniciansalary Award void Output Salary cout 编号 No t 级别 Grade t 姓名 Name t 性别 Sex t 血型 Blood t 出生 Birth t 联系电话 Tel t 特长 Technicial t 星座 Constellation t 开始工作时间 Timeofbegin t 加入 公司时间 Timeofcome t 技术员 t 工资 Earning endl void Output1 Salary cout 编号 No t 级别 Grade t 姓名 Name t 技术 员 endl void Output2 Salary cout 编号 No t 级别 Grade t 姓名 Name t 技术 员 t 工资 Earning Award Award double GetAward return Award void SetAward double Amount this Award Amount void Salary Earning Tmanagersalary Award void Output Salary cout 编号 No t 级别 Grade t 姓名 Name t 性别 Sex t 血型 Blood t 出生 Birth t 联系电话 Tel t 特长 Technicial t 星座 Constellation t 开始工作时间 Timeofbegin t 加入 公司时间 Timeofcome t 技术经理 t 工资 Earning endl void Output1 Salary cout 编号 No t 级别 Grade t 姓名 Name t 技术经理 endl void Output2 Salary cout 编号 No t 级别 Grade t 姓名 Name t 技术经理 t 工资 Earning next delete Worker Worker p Worker 0 void Find char Name 20 按姓名查找 void Find int ID 按编号查找 void Add 增加人员 void Delete 删除人员 void Change 修改人员 void Search 查询人员 void Save 数据存盘 包括基础数据 人员数据 void Money 月薪计算 void Company Find char Name 20 查询人员的函数 void Company Add 增加员工函数 Employee p 新结点指针 int Duty char Name 20 char Sex 2 性别 char Birth 10 char Tel 20 联系方式 char Technicial 20 char Constellation 20 星座 char Blood 3 血型 char Timeofbegin 10 char Timeofcome 10 int Grade double Workload 0 cout n 新增员工 n 输入员工信息 cout 工号 ID n cout 1 经理 2 技术经理 3 销售经理 4 技术人员 5 销售人员 n cout 请选择新增人员职位 Duty if Duty 1 Grade 4 else if Duty 2 Duty 3 Grade 3 else if Duty 4 Grade 2 else Grade 1 cout Name cout Sex cout Birth cout Tel cout Technicial cout Constellation cout Blood cout Timeofbegin cout Timeofcome switch Duty case 1 p new Manager ID Grade Name Sex Birth Blood Tel Technicial Constellation Timeofbegin Tim eofcome Duty break case 2 p new Technicianmanager ID Grade Name Sex Birth Blood Tel Technicial Constellation Timeof begin Timeofcome Duty Workload break case 3 p new Salesmanager ID Grade Name Sex Birth Blood Tel Technicial Constellation Timeofbegin T imeofcome Duty Workload break case 4 p new Technician ID Grade Name Sex Birth Blood Tel Technicial Constellation Timeofbegin Ti meofcome Duty Workload break case 5 p new Salesman ID Grade Name Sex Birth Blood Tel Technicial Constellation Timeofbegin Ti meofcome Duty Workload break p next 0 员工结点加入链表 if Worker 若已经存在结点 Employee p2 p2 Worker while p2 next 查找尾结点 p2 p2 next p2 next p 连接 else 若不存在结点 表空 Worker p 连接 cout 新员工已添加 void Company Delete 删除人员函数 int No cout n 删除员工 n cout No 查找要删除的结点 Employee p1 p2 p1 Worker while p1 if p1 No No break else p2 p1 p1 p1 next 删除结点 if p1 NULL 若找到结点 则删除 if p1 Worker 若要删除的结点是第一个结点 Worker p1 next delete p1 else 若要删除的结点是后续结点 p2 next p1 next delete p1 cout 找到并删除 n else 未找到结点 cout 未找到 n void Company Change 修改人员函数 int No Duty char Name 20 char Sex 3 char Birth 10 char Blood 3 char Tel 20 char Technicial 20 char Constellation 20 char Timeofbegin 10 char Timeofcome 10 double Workload int Grade cout n 修改员工 n cout No 查找要修改的结点 Employee p1 p2 p1 Worker while p1 if p1 No No break else p2 p1 p1 p1 next 修改 if p1 NULL 若找到结点 p1 Output cout Duty if p1 Duty Duty 若职位发生变动 修改其它数据 cout Name cout Sex cout Birth cout Tel cout Technicial cout Constellation cout Blood cout Timeofbegin cout Timeofcome if Duty 1 Grade 4 else if Duty 2 Duty 3 Grade 3 else if Duty 4 Grade 2 Else Grade 1 if Duty 2 if Duty 3 创建新员工结点 Employee p3 switch Duty case 1 p3 new Manager p1 No Grade Name Sex Birth Blood Tel Technicial Constellation Timeofbegin Timeofcome Duty break case 2 p3 new Technicianmanager p1 No Grade Name Sex Birth Blood Tel Technicial Constellation Timeofbegin Timeofcome Duty Workload break case 3 p3 new Salesmanager p1 No Grade Name Sex Birth Blood Tel Technicial Constellation Timeofbegin Timeofcome Duty Workload break case 4 p3 new Technician p1 No Grade Name Sex Birth Blood Tel Technicial Constellation Timeofbegin Timeofcome Duty Workload break case 5 p3 new Salesman p1 No Grade Name Sex Birth Blood Tel Technicial Constellation Timeofbegin Timeofcome Duty Workload break 员工结点替换到链表 p3 next p1 next if p1 Worker 若要替换的结点是第一个结点 Worker p3 else p2 next p3 若要删除的结点是后续结点 delete p1 删除原来的员工结点 else 若职位没有变动 cout p1 Name if Duty 2 cout Workload Technicianmanager p1 SetAward Workload else if Duty 3 cout Workload Salesmanager p1 SetWorkload Workload else if Duty 4 cout Workload Technician p1 SetAward Workload else if Duty 5 cout Workload Salesman p1 SetWorkload Workload cout 修改成功 n else 未找到结点 cout 未找到 n void Company Search 查找人员 char xingming 10 count 0 cout Output1 sum2 p Earning p p next cout 本月实发工资总数 sum2 元 endl char choose cout 是否继续 Y N choose do cout xingming Employee p4 Worker while p4 if strcmp p4 Name xingming 0 if p4 Duty 1 Manager p4 Output count break else if p4 Duty 2 Technicianmanager p4 Output count break else if p4 Duty 3 Salesmanager p4 Output count break else if p4 Duty 4 Technician p4 Output count break else if p4 Duty 5 Salesman p4 Output count break else p4 p4 next if count 0 cout 未找到 endl cout 是否继续 Y N choose while choose y choose Y void Company Save 数据存盘 采用文本文件 ofstream fEmployee char c cout c if toupper c Y return 保存人员编号 姓名 职位等信息 fEmployee open Employee txt ios out Employee p Worker while p fEmployee No t Name t Duty Duty 2 fEmployee GetAward Duty 3 fEmployee GetWorkload Duty 4 fEmployee GetAward Duty 5 fEmployee GetWorkload t fEmployee next fEmployee close cout 保存成功 void Company Money 计算工资的指针函数 int Duty double Workload Employee p1 Worker cout Output1 Duty p1 Duty if Duty 1 cout next else if Duty 2 cout Workload Technicianmanager p1 SetAward Workload cout next else if Duty 3 cout Workload Salesmanager p1 SetWorkload Workload co
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 森林温泉疗养基地创新创业项目商业计划书
- 谐波精密减速器创新创业项目商业计划书
- 米饭自动分装机企业制定与实施新质生产力项目商业计划书
- 纳米电子元件企业制定与实施新质生产力项目商业计划书
- DB41T 2917-2025地质空间三棱台八叉树网格剖分编码规范
- DB41T 2872-2025夏枯草种子生产技术规程
- 2025年监理工程师合同管理考试真题(附答案)
- 社区访谈与沟通技巧100
- 安全培训平台介绍词大全课件
- 上年银行从业考试试卷及答案解析
- 照片档案整理规范
- 糖尿病胰岛素泵的护理查房课件
- 2023新能源集控中心及智慧电厂建设方案
- 人工智能(基础版)高职人工智能基础课程PPT完整全套教学课件
- 10胃十二指肠溃疡临床路径表单
- 高标准农田施工组织设计(全)
- 外科学(1)智慧树知到答案章节测试2023年温州医科大学
- 软件开发安全管理办法
- 消费者的注意
- 《安娜·卡列尼娜》-课件-
- 2022年新版体系文件药品零售单体连锁总部质量管理体系文件
评论
0/150
提交评论