欢迎来到装配图网! | 帮助中心 装配图网zhuangpeitu.com!
装配图网
ImageVerifierCode 换一换
首页 装配图网 > 资源分类 > DOC文档下载
 

小型公司的工资管理系统实训报告

  • 资源ID:131092711       资源大小:692KB        全文页数:29页
  • 资源格式: DOC        下载积分:26积分
快捷下载 游客一键下载
会员登录下载
微信登录下载
三方登录下载: 微信开放平台登录 支付宝登录   QQ登录   微博登录  
二维码
微信扫一扫登录
下载资源需要26积分
邮箱/手机:
温馨提示:
用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)
支付方式: 支付宝    微信支付   
验证码:   换一换

 
账号:
密码:
验证码:   换一换
  忘记密码?
    
友情提示
2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。

小型公司的工资管理系统实训报告

面向对象实训报告- 题目 :小型公司的工资管理系统指导老师:xxx学生姓名:xxx班级:计 Yxxx学号:xxxxxxxxxxx时间:xxxx年 x 月 x 日目录一、实训内容与目的-2二、设计分析-3三、执行结果和结果分析-23四、实训总结- 27一、 实训内容 :小型公司的工资管理设计任务编写一个小型公司的工资管理程序。该公司主要有 4 类人员:经理、兼职技术人员、销售员和销售经理。其中月薪计算方法为:经理固定月薪8000 元,兼职技术如愿100元/ 小时,销售员为当月销售额的 4%,销售经理保底工资 5000 元另加所管部门销售额的 5。设计要求(1) 职工编号自动产生(从1000 起编号)。(2) 将公司人员的编号、 姓名和月薪等信息保存在文件中,然后从文件中读入这些信息并显示。如果访问文件失败,采用异常处理机制解决。(3) 设计输入,输出的界面。 (成绩为优良,需采用 MFC方式。若设计困难可以使用DOS方式)二、设计分析 :(1) 类的定义:1、 “employee. h”#include<iostream.h>#include<iomanip.h>#include<stdio.h>#include<string.h>#include<fstream.h>#include<tchar.h>class employeepublic:employee();double gerno();char *getname();char *gerpost();double getsalary();virtualdouble pay()=0;employee(double n,char mingzi20,double s)number=n;strcpy(name,mingzi);income=s;employee();protected:double number;char name20;char post20;double income;class Technician: public employeeprotected:double hour;double per;public:double Set_hour();double pay();class Saleman:virtual public employeeprotected:double salary;/销售额public:void sale();double pay();class Manager:virtual public employeeprotected:public:double pay();class Salesmanager:virtual public Manager,virtual public Saleman public:double pay();struct personint gonghao;char xingming20;char zhiwei20;float shouru;float xiaoshi;void saverenshu();int readrenshu();void deletgon(int x);void deletname(int x);void read(int x);void xiugai_all(int x);void savetech(int x,char *y,char *z,float e,float ho);void save(int x,char *y,char *z,float e);(2)” change.cpp ”#include"employee.h"int k;void save(int x,char *y,char *z,float e)/ 保存文件struct person a;a.gonghao=x;strcpy(a.xingming,y);strcpy(a.zhiwei,z);a.shouru=e;cout<<" 工 号 : "<<a.gonghao<<""<<" 姓 名 : "<<a.xingming<<""<<" 职 位 :"<<a.zhiwei<<" "<<"工资: "<<a.shouru<<" "<<endl;fstream cun;cun.open(" 保存人员 .txt",ios:app|ios:out);if(!cun)cout <<"cannot open file"<<endl;cun<<a.gonghao<<endl;cun<<a.zhiwei<<endl;cun<<a.xingming<<endl;cun<<a.shouru<<endl;cun.close();void savetech(int x,char *y,char *z,float e,float ho)/ 专用于技术员的保存struct person a;a.gonghao=x;strcpy(a.xingming,y);strcpy(a.zhiwei,z);a.shouru=e;a.xiaoshi=ho;cout<<" 工 号 : "<<a.gonghao<<""<<" 姓 名 : "<<a.xingming<<""<<" 职 位 :"<<a.zhiwei<<"工作小时: "<<a.xiaoshi<<" "<<"工资: "<<a.shouru<<" "<<endl;fstream cun;cun.open(" 保存人员 .txt",ios:app|ios:out);if(!cun)cout <<"cannot open file"<<endl;cun<<a.gonghao<<endl;cun<<a.zhiwei<<endl;cun<<a.xingming<<endl;cun<<a.xiaoshi<<endl;cun<<a.shouru<<endl;cun.close();void saverenshu()/ 保存在职总人数,以便读取数据fstream cun;cun.open(" 个数 .txt",ios:trunc|ios:in);if(!cun)cout <<"cannot open file"<<endl;cun<<k<<endl;cun.close();int readrenshu()/ 读取在职总人数fstream cun;cun.open(" 个数 .txt",ios:in|ios:out);if(!cun)cout <<"cannot open file"<<endl;cun>>k;return k;void read(int x)/ 读取在职人员信息,参数x 为总人数if(x=0)cout<<" 还没有任何人员的信息,请先添加人员的信息!"<<endl;struct person a30;fstream cun;int i=0;cun.open(" 保存人员 .txt",ios:in|ios:out);if(!cun)cout <<"cannot open file"<<endl;while(i<x)cun>>ai.gonghao;cun>>ai.zhiwei;cun>>ai.xingming;if(strcmp(ai.zhiwei,"技术员 ")=0)cun>>ai.xiaoshi;cun>>ai.shouru;if(strcmp(ai.zhiwei,"技术员 ")=0)cout<<" 工号: "<<ai.gonghao<<" "<<"姓名: "<<ai.xingming<<""<<"职 位 :"<<ai.zhiwei<<"工作小时"<<ai.xiaoshi<<""<<"工 资 :"<<ai.shouru<<" "<<endl;elsecout<<"工号: "<<ai.gonghao<<""<<"姓名: "<<ai.xingming<<""<<"职位: "<<ai.zhiwei<<" "<<"工资: "<<ai.shouru<<" "<<endl;i+;cun.close();void deletgon(int x)/ 按工号删除函数,参数x 为总人数if(x=0)cout<<" 没有任何员工的信息,请先增加员工的信息"<<endl;struct person a130;struct person a230;fstream cun;int i=0;cun.open(" 保存人员 .txt",ios:in|ios:out);if(!cun)cout <<"cannot open file"<<endl;while(i<x)cun>>a1i.gonghao;cun>>a1i.zhiwei;cun>>a1i.xingming;if(strcmp(a1i.zhiwei,"技术员 ")=0)cun>>a1i.xiaoshi;cun>>a1i.shouru;if(strcmp(a1i.zhiwei,"技术员 ")=0)"<<"cout<<" 工号: "<<a1i.gonghao<<" "<<"姓名: "<<a1i.xingming<<"职 位 : "<<a1i.zhiwei<<"工 作 小 时"<<a1i.xiaoshi<<""<<" 工 资 :"<<a1i.shouru<<" "<<endl;else"<<"cout<<" 工号: "<<a1i.gonghao<<" "<<"姓名: "<<a1i.xingming<<"职位: "<<a1i.zhiwei<<" "<<"工资: "<<a1i.shouru<<" "<<endl;i+;cun.close();/cout<<" 请输入要删除人员的工号:"<<endl;int g;cin>>g;i=0;while(g!=a1i.gonghao)i+;if(g!=a1i.gonghao)cout<<" 没找到! "<<endl;elseg=i;for(i=0;i!=g;i+)a2i.gonghao=a1i.gonghao;strcpy(a2i.zhiwei,a1i.zhiwei);strcpy(a2i.xingming,a1i.xingming);if(strcmp(a1i.zhiwei,"技术员 ")=0)a2i.xiaoshi=a1i.xiaoshi;a2i.shouru=a1i.shouru;for(i;i<x;i+)a2i.gonghao=a1i+1.gonghao;strcpy(a2i.zhiwei,a1i+1.zhiwei);strcpy(a2i.xingming,a1i+1.xingming);if(strcmp(a1i+1.zhiwei,"技术员 ")=0)a2i.xiaoshi=a1i+1.xiaoshi;a2i.shouru=a1i+1.shouru;for(int l=0;l<(x-1);l+)if(strcmp(a2l.zhiwei,"技术员 ")=0)cout<<"工号:"<<a2l.gonghao<<""<<"姓名:"<<a2l.xingming<<""<<"职 位 :"<<a2l.zhiwei<<"工作小时"<<a2l.xiaoshi<<""<<"工 资 :"<<a2l.shouru<<" "<<endl;elsecout<<" 工号:"<<a2l.gonghao<<""<<" 姓名:"<<a2l.xingming<<""<<" 职位: "<<a2l.zhiwei<<" "<<"工资: "<<a2l.shouru<<" "<<endl;fstream cun1;i=0;cun1.open(" 保存人员 .txt",ios:trunc);if(!cun1)cout <<"cannot open file"<<endl;while(i<(x-1)cun1<<a2i.gonghao<<endl;cun1<<a2i.zhiwei<<endl;cun1<<a2i.xingming<<endl;if(strcmp(a2i.zhiwei,"技术员 ")=0)cun1<<a2i.xiaoshi<<endl;cun1<<a2i.shouru<<endl;i+;cun1.close();fstream cun2;cun2.open(" 个数 .txt",ios:trunc|ios:in);if(!cun2)cout <<"cannot open file"<<endl;cun2<<(x-1)<<endl;cout<<" 成功删除一个员工的数据"<<endl;cun2.close();void deletname(int x)/ 按姓名删除函数,参数x 为总人数if(x=0)cout<<" 没有任何员工的信息,请先增加员工的信息"<<endl;struct person a130;struct person a230;fstream cun;int i=0;cun.open(" 保存人员 .txt",ios:in|ios:out);if(!cun)cout <<"cannot open file"<<endl;while(i<x)cun>>a1i.gonghao;cun>>a1i.zhiwei;cun>>a1i.xingming;if(strcmp(a1i.zhiwei,"技术员 ")=0)cun>>a1i.xiaoshi;cun>>a1i.shouru;if(strcmp(a1i.zhiwei,"技术员 ")=0)"<<"cout<<" 工号: "<<a1i.gonghao<<" "<<"姓名: "<<a1i.xingming<<"职 位 : "<<a1i.zhiwei<<"工 作 小 时"<<a1i.xiaoshi<<""<<" 工 资 :"<<a1i.shouru<<" "<<endl;else"<<"cout<<" 工号: "<<a1i.gonghao<<" "<<"姓名: "<<a1i.xingming<<"职位: "<<a1i.zhiwei<<" "<<"工资: "<<a1i.shouru<<" "<<endl;i+;cun.close();/cout<<" 请输入要删除人员的姓名:"<<endl;char xing20;cin>>xing;int g;i=0;while(strcmp(xing,a1i.xingming)i+;g=i;for(i=0;i!=g;i+)a2i.gonghao=a1i.gonghao;strcpy(a2i.zhiwei,a1i.zhiwei);strcpy(a2i.xingming,a1i.xingming);if(strcmp(a1i.zhiwei,"技术员 ")=0)a2i.xiaoshi=a1i.xiaoshi;a2i.shouru=a1i.shouru;for(i;i<x;i+)a2i.gonghao=a1i+1.gonghao;strcpy(a2i.zhiwei,a1i+1.zhiwei);strcpy(a2i.xingming,a1i+1.xingming);if(strcmp(a1i+1.zhiwei,"技术员 ")=0)a2i.xiaoshi=a1i+1.xiaoshi;a2i.shouru=a1i+1.shouru;for(int l=0;l<(x-1);l+)if(strcmp(a2l.zhiwei,"技术员 ")=0)cout<<" 工号: "<<a2l.gonghao<<" "<<"姓名: "<<a2l.xingming<<" "<<"职 位 : "<<a2l.zhiwei<<"工 作 小 时"<<a2l.xiaoshi<<""<<" 工 资 :"<<a2l.shouru<<" "<<endl;else"<<"cout<<" 工号: "<<a2l.gonghao<<" "<<"姓名: "<<a2l.xingming<<"职位: "<<a2l.zhiwei<<" "<<"工资: "<<a2l.shouru<<" "<<endl;fstream cun1;i=0;cun1.open(" 保存人员 .txt",ios:trunc);if(!cun1)cout <<"cannot open file"<<endl;while(i<(x-1)cun1<<a2i.gonghao<<endl;cun1<<a2i.zhiwei<<endl;cun1<<a2i.xingming<<endl;if(strcmp(a2i.zhiwei,"技术员 ")=0)cun1<<a2i.xiaoshi<<endl;cun1<<a2i.shouru<<endl;i+;cun1.close();fstream cun2;cun2.open(" 个数 .txt",ios:trunc|ios:in);if(!cun2)cout <<"cannot open file"<<endl;cun2<<(x-1)<<endl;cout<<" 成功删除一个员工的数据"<<endl;cun2.close();void xiugai_all(int x)/ 修改一条记录的内容,参数x 为总人数struct person a130;struct person a230;fstream cun;int i=0;cun.open(" 保存人员 .txt",ios:in|ios:out);if(!cun)cout <<"cannot open file"<<endl;while(i<x)cun>>a1i.gonghao;cun>>a1i.zhiwei;cun>>a1i.xingming;if(strcmp(a1i.zhiwei,"技术员 ")=0)cun>>a1i.xiaoshi;cun>>a1i.shouru;if(strcmp(a1i.zhiwei,"技术员 ")=0)cout<<" 工号: "<<a1i.gonghao<<" "<<"姓名: "<<a1i.xingming<<""<<" 职 位 : "<<a1i.zhiwei<<"工 作 小 时"<<a1i.xiaoshi<<""<<" 工 资 :"<<a1i.shouru<<" "<<endl;elsecout<<"工号:"<<a1i.gonghao<<" "<<"姓名:"<<a1i.xingming<<""<<"职位: "<<a1i.zhiwei<<" "<<"工资: "<<a1i.shouru<<" "<<endl;i+;int g,gonghao1;char xingming120,zhiwei120;float shouru1,xiaoshi1;cout<<" 请输入要修改员工的工号:"<<endl;cin>>g;i=0;while(g!=a1i.gonghao)i+;g=i;for(i=0;i!=g;i+)a2i.gonghao=a1i.gonghao;strcpy(a2i.zhiwei,a1i.zhiwei);strcpy(a2i.xingming,a1i.xingming);if(strcmp(a1i.zhiwei,"技术员 ")=0)a2i.xiaoshi=a1i.xiaoshi;a2i.shouru=a1i.shouru;cout<<" 请重新输入工号: "<<endl;cin>>gonghao1;a2i.gonghao=gonghao1;cout<<" 请重新输入姓名: "<<endl;cin>>xingming1;strcpy(a2i.xingming,xingming1);cout<<" 请重新输入职位: "<<endl;cin>>zhiwei1;strcpy(a2i.zhiwei,zhiwei1);if(strcmp(zhiwei1,"技术员 ")=0)cout<<" 请重新输入工作小时数:"<<endl;cin>>xiaoshi1;a2i.xiaoshi=xiaoshi1;cout<<" 请重新输入月收入: "<<endl;cin>>shouru1;a2i.shouru=shouru1;if(strcmp(a2i.zhiwei,"技术员 ")=0)cout<<" 工号: "<<a2i.gonghao<<""<<a2i.zhiwei<<"工作小时:"<<"姓名: "<<a2i.xingming<<""<<a2i.xiaoshi<<""<<""<<" 职位:工资:"<<a2i.shouru<<" "<<endl;else"<<"cout<<" 工号: "<<a2i.gonghao<<" "<<"姓名: "<<a2i.xingming<<"职位: "<<a2i.zhiwei<<" "<<"工资: "<<a2i.shouru<<" "<<endl;i=i+1;for(i;i<x;i+)a2i.gonghao=a1i.gonghao;strcpy(a2i.zhiwei,a1i.zhiwei);strcpy(a2i.xingming,a1i.xingming);if(strcmp(a2i.zhiwei,"技术员 ")=0)a2i.xiaoshi=a1i.xiaoshi;a2i.shouru=a1i.shouru;fstream cun1;i=0;cun1.open(" 保存人员 .txt",ios:trunc);if(!cun1)cout <<"cannot open file"<<endl;while(i<x)cun1<<a2i.gonghao<<endl;cun1<<a2i.xingming<<endl;cun1<<a2i.zhiwei<<endl;if(strcmp(a2i.zhiwei,"技术员 ")=0)cun1<<a2i.xiaoshi<<endl;cun1<<a2i.shouru<<endl;i+;cun.close();(3)“employee.cpp ”#include"employee.h"#include<iostream.h>#include<iomanip.h>#include<string.h>#include<stdio.h>#include<stdlib.h>#include<fstream.h>double employee:gerno()cout<<" 请输入工号 "<<endl;cin>>number;return number;char *employee:getname()cout<<" 请输入姓名 "<<endl;cin>>name;return name;char *employee:gerpost()cout<<" 请输入职位 "<<endl;cin>>post;return post;/double Technician:pay()income=30*100*hour;return income;double Technician:Set_hour()cout<<" 工作时间: "cin>>hour;return hour;/void Saleman:sale()/ 当月销售额cout<<" 请输入当月销售额 "<<endl;cin>>salary;double Saleman:pay()income=salary*0.04;return income;/double Manager:pay()income=8000;return income;/double Salesmanager:pay()income=5000+salary*0.05;return income;(3) ” employee .cpp ”#include"employee.h"#include<iostream.h>#include<iomanip.h>#include<string.h>#include<stdio.h>#include<stdlib.h>#include<fstream.h>double employee:gerno()cout<<" 请输入工号 "<<endl;cin>>number;return number;char *employee:getname()cout<<" 请输入姓名 "<<endl;cin>>name;return name;char *employee:gerpost()cout<<" 请输入职位 "<<endl;cin>>post;return post;/double Technician:pay()income=30*100*hour;return income;double Technician:Set_hour()cout<<" 工作时间: "cin>>hour;return hour;/void Saleman:sale()/ 当月销售额cout<<" 请输入当月销售额 "<<endl;cin>>salary;double Saleman:pay()income=salary*0.04;return income;/double Manager:pay()income=8000;return income;/double Salesmanager:pay()income=5000+salary*0.05;return income;(4) ” gzgl.cpp ”#include"employee.h"#include<string.h>#include<stdio.h>#include<stdlib.h>#include<fstream.h>#include<iomanip.h>#include <iostream.h>#include <fstream.h>int IntputMenu();void readmenu();int deletmenu();int xiugaimenu();int Showmenu();int ai;extern int k;void main()Showmenu();int Showmenu()int nu;nu=readrenshu();while(1)cout<<endl;cout<<"小型公司工资管理系统"<<endl;cout<<" "<<endl;cout<<" 请选择您所需要的操作:"<<endl;cout<<" 数据录入 :1, 并按回车键 "<<endl;cout<<" 删除数据 :2,并按回车键 "<<endl;cout<<" 修改数据 :3,并按回车键 "<<endl;cout<<" 读入数据 :4, 并按回车键 "<<endl;cout<<" 退出系统 :5, 并按回车键 "<<endl;cout<<" "<<endl;cout<<endl<<endl<<endl;cout<<" 请选择一个操作:"cin>>ai;switch(ai)case 1:IntputMenu();break;case 2:deletmenu();break;case 3:xiugaimenu();break;case 4:readmenu();break;case 5:return 0;break;default:cout<<" 你的选择出错了! "<<" 请重新输入吧! "<<endl; int deletmenu()while(1)int r;r=readrenshu();cout<<endl;cout<<"小型公司工资管理系统 "<<endl;cout<<" "<<endl;cout<<" 请选择您所需要的操作:"<<endl;cout<<" 按工号删除 :1, 并按回车键 "<<endl;cout<<" 按姓名删除 :2,并按回车键 "<<endl;cout<<" 返回上一层 :3, 并按回车键 "<<endl;cout<<" "<<endl;cout<<endl<<endl<<endl;cout<<" 请选择一个操作:"cin>>ai;switch(ai)case 1:deletgon(r);break;case 2:deletname(r);break;case 3:return 0;break;default:cout<<" 你的选择出错了! "<<" 请重新输入吧! "<<endl; void readmenu()int r;r=readrenshu();read(r);int xiugaimenu()while(1)int r;r=readrenshu();cout<<endl;cout<<"小型公司工资管理系统 "<<endl;cout<<" "<<endl;cout<<" 请选择您所需要的操作:"<<endl;cout<<" 修改工号 :1,并按回车键 "<<endl;cout<<" 修改姓名 :2,并按回车键 "<<endl;cout<<" 修改职位 :3,并按回车键 "<<endl;cout<<" 修改全部 :4,并按回车键 "<<endl;cout<<" 返回上一层 :5, 并按回车键 "<<endl;cout<<" "<<endl; cout<<endl<<endl<<endl;cout<<" 请选择一个操作:"cin>>ai;switch(ai)/case 1:deletgon(r);break;/case 2:deletname(r);break;case 4:xiugai_all(r);break;case 5:return 0;break;default:cout<<" 你的选择出错了! "<<" 请重新输入吧! "<<endl; int IntputMenu()cout<<"小型公司工资管理系统 "<<endl;cout<<""<<endl;cout<<"请选择您所需要的操作 "<<endl;cout<<" 经理数据输入: 1,并按回车键 "<<endl;cout<<" 技术员数据输入: 2,并按回车键 "<<endl;cout<<" 销售员数据输入: 3,并按回车键 "<<endl;cout<<" 销售经理数据输入 : 4,并按回车键 "<<endl;cout<<" 返回上一层: 5,并按回车键 "<<endl;cout<<""<<endl;cout<<"请选择一个操作:"cin>>ai;switch(ai) case 1:Manager jingli;double a;char *b,*c;double d;a=jingli.gerno();b=jingli.gerpost();c=jingli.getname();d=jingli.pay();save(a,c,b,d);cout<<" 已经成功保存啦! "<<endl;k+;saverenshu();break;case 2: Technician jishu;double a;char *b,*c;double d,f;a=jishu.gerno();b=jishu.gerpost();c=jishu.getname();f=jishu.Set_hour();d=jishu.pay();savetech(a,c,b,d,f);cout<<" 已经成功保存啦! "<<endl;k+;saverenshu();break;case 3:Saleman xiaoshou;int a;char *b,*c;float d,f;a=xiaoshou.gerno();b=xiaoshou.gerpost();c=xiaoshou.getname();xiaoshou.sale();d=xiaoshou.pay();save(a,c,b,d);cout<<" 已经成功保存啦! "<<endl;k+;saverenshu();break;case 4:Salesmanager xiaoshoujingli;int a;char *b,*c;float d;a=xiaoshoujingli.gerno();b=xiaoshoujingli.gerpost();c=xiaoshoujingli.getname();xiaoshoujingli.sale();d=xiaoshoujingli.pay();save(a,c,b,d);cout<<" 已经成功保存啦! "<<endl;k+;saverenshu();break;case 5: return 0; break;default:cout<<"你的选择出错了! "<<" 请重新输入吧! "<<endl;三、执行结果和结果分析实验截图:1、添加数据:

注意事项

本文(小型公司的工资管理系统实训报告)为本站会员(Sc****h)主动上传,装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知装配图网(点击联系客服),我们立即给予删除!

温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载不扣分。




关于我们 - 网站声明 - 网站地图 - 资源地图 - 友情链接 - 网站客服 - 联系我们

copyright@ 2023-2025  zhuangpeitu.com 装配图网版权所有   联系电话:18123376007

备案号:ICP2024067431-1 川公网安备51140202000466号


本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知装配图网,我们立即给予删除!