C++小型企业工资管理系统

上传人:博****1 文档编号:510543641 上传时间:2023-02-18 格式:DOCX 页数:21 大小:84.64KB
返回 下载 相关 举报
C++小型企业工资管理系统_第1页
第1页 / 共21页
C++小型企业工资管理系统_第2页
第2页 / 共21页
C++小型企业工资管理系统_第3页
第3页 / 共21页
C++小型企业工资管理系统_第4页
第4页 / 共21页
C++小型企业工资管理系统_第5页
第5页 / 共21页
点击查看更多>>
资源描述

《C++小型企业工资管理系统》由会员分享,可在线阅读,更多相关《C++小型企业工资管理系统(21页珍藏版)》请在金锄头文库上搜索。

1、一、需求分析1. 从要求上来看是要对各个员工的各种情况(名字、年龄、性别、职位、工资状况)进行输入。然后可以输出.2. 可以对于员工数据进行修改,可以查询.3. 对于员工的各种情况系统还可以进行统计排名.二、概要设计首先,创建了一个employee类.然后派生出四个类: manager、technician、salesman、sales manager.在派生类中定义了三个构造函数,分别是:数据输入函数(Input),表格输出函数(Print),排序函数(Pay).其次,在总体结构上,建立以各根菜单,用于选择各种功能.1. Input(数据输入):输入员工的各种数据.2. Total(数据统计

2、):将员工的总数据进行对比排序,然后输出.3. Output(数据显示):显示输入的各种数据.4. Save(数据保存):对输入的数据进行保存备份.5. Eixt(退出程序):执行退出程序命令.三、详细设计1. Input(数据输入): 定义了各个岗位的人员的类,并把每个类的人员的属性设为类中的保护成员,其中技术工的工作时间和每小时的所得为私有成员,而销售员的销售额、经理的工资和销售经理的所辖部门的销售额和其底薪设为公有成员,再依次录入。2. Total(数据统计): 根据所有类的工资算法在其所属类中定义一个函数void pay()来根据各个职位的具体情况来计算工资,并且算出的工资经过冒泡法排

3、序.void printtotal()coutendl;coutTotal setw(10)total endl;coutendl;3. Output(数据显示): 通过do-while循环以及制表格和setw的使用将输入的数据和统计并排序的数据以表格的形式打印出来,销售额合计一栏宽度要大些。void saleprint()coutsetw(10)no1setw(10)name1setw(10)sale1endl;coutendl;coutsetw(10)no2setw(10)name2setw(10)sale2endl;coutendl;coutsetw(10)no3setw(10)name

4、3setw(10)sale3endl;coutendl;coutsetw(10)no4setw(10)name4setw(10)sale4endl;void print()coutendl;coutsetw(10)nosetw(10)namesetw(10)sexsetw(10)agesetw(10)salaryendl;4. Save(数据保存): 通过函数save()来将输入的数据和统计并排序的数据进行保存.例如:void save()fstream outfile;outfile.open(f:flsdfj.txt,ios:app);if(!outfile)coutf cant open

5、.n;abort();outfileSales mangerendl;outfileIDnoNAMEnameSEXsexAGEageSALARYsalaryendl; 5. Eixt(退出):利用exit来完成退出系统功能。四、设计和调试分析程序清单:#include#include#include#include#includeclass employeepublic:employee()salary=0;void pay()void print()void input()coutno;coutname;coutsex;coutage;protected:int no;char name8;

6、float salary;char sex;int age;class manager:virtual public employeeprotected:float monthlypay,sale;public:manager()monthlypay=8000; void input()coutManger;employee:input();void save()fstream outfile;outfile.open(f:flsdfj.txt,ios:app);if(!outfile)coutf cant open.n;abort();outfileMangerendl;outfileIDn

7、oNAMEnameSEXsexAGEageSALARYsalaryendl;void pay()salary=monthlypay;void print()coutendl;coutsetw(10)nosetw(10)namesetw(10)sexsetw(10)agesetw(10)salaryendl;class technician:virtual public employeeprivate:float hourlyrate;int workhours;public:technician()hourlyrate=100;void pay()coutnameworkhours;salar

8、y=hourlyrate*workhours;void input()coutTECHNICIANendl;employee:input();void save()fstream outfile;outfile.open(f:flsdfj.txt,ios:app);if(!outfile)coutf cant open.n;abort();outfileTECHNICIANendl;outfileIDnoNAMEnameSEXsexAGEageSALARYsalaryendl;void print()coutendl;coutsetw(10)nosetw(10)namesetw(10)sexs

9、etw(10)agesetw(10)salaryendl;class salesman:virtual public employeeprotected:float commrate;float sales;public:salesman()commrate=0.04; void input()coutSALEMAN;employee:input();void save()fstream outfile;outfile.open(f:flsdfj.txt,ios:app);if(!outfile)coutf cant open.n;abort();outfileTECHNICIANendl;o

10、utfileIDnoNAMEnameSEXsexAGEageSALARYsalaryendl;void pay()coutnamesales; salary=sales*commrate;void print()coutendl;coutsetw(10)nosetw(10)namesetw(10)sexsetw(10)agesetw(10)salaryendl;class salesmanager:virtual public manager,virtual public salesmanprivate:float total;int no1,no2,no3,no4;char name18,name28,name38,name48;float sale1,sale2,sale3,sale4;public:void salemanager()monthlypay=5000;commrate=0.005;void input()coutSales manger;employee:input();void save()fstream outfile;outfile.open(f:flsdfj.txt,ios:app);if(!outfile)coutf cant open.n;

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 商业/管理/HR > 销售管理

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号