C小型企业工资管理系统.docx
- 文档编号:2297523
- 上传时间:2022-10-28
- 格式:DOCX
- 页数:15
- 大小:18.44KB
C小型企业工资管理系统.docx
《C小型企业工资管理系统.docx》由会员分享,可在线阅读,更多相关《C小型企业工资管理系统.docx(15页珍藏版)》请在冰豆网上搜索。
C小型企业工资管理系统
一、需求分析
1.从要求上来看是要对各个员工的各种情况(名字、年龄、性别、职位、工资状况)进行输入。
然后可以输出.
2.可以对于员工数据进行修改,可以查询.
3.对于员工的各种情况系统还可以进行统计排名.
二、概要设计
首先,创建了一个employee类.然后派生出四个类:
manager、technician、salesman、salesmanager.在派生类中定义了三个构造函数,分别是:
数据输入函数(Input),表格输出函数(Print),排序函数(Pay).
其次,在总体结构上,建立以各根菜单,用于选择各种功能.
1.Input(数据输入):
输入员工的各种数据.
2.Total(数据统计):
将员工的总数据进行对比排序,然后输出.
3.Output(数据显示):
显示输入的各种数据.
4.Save(数据保存):
对输入的数据进行保存备份.
5.Eixt(退出程序):
执行退出程序命令.
三、详细设计
1.Input(数据输入):
定义了各个岗位的人员的类,并把每个类的人员的属性设为类中的保护成员,其中技术工的工作时间和每小时的所得为私有成员,而销售员的销售额、经理的工资和销售经理的所辖部门的销售额和其底薪设为公有成员,再依次录入。
2.Total(数据统计):
根据所有类的工资算法在其所属类中定义一个函数voidpay()来根据各个职位的具体情况来计算工资,并且算出的工资经过冒泡法排序.
voidprinttotal()
{
cout<<"├─────┴──┬──┴─────┤"< cout<<"│Total │ "< cout<<"└────────┴────────┘"< } 3.Output(数据显示): 通过do-while循环以及制表格和setw的使用将输入的数据和统计并排序的数据以表格的形式打印出来,销售额合计一栏宽度要大些。 voidsaleprint() { cout<<"│"< cout<<"├─────┼─────┼─────┤"< cout<<"│"< cout<<"├─────┼─────┼─────┤"< cout<<"│"< cout<<"├─────┼─────┼─────┤"< cout<<"│"< } voidprint() { cout<<"├─────┼─────┼─────┼─────┼─────┤"< cout<<"│"< < } 4.Save(数据保存): 通过函数save()来将输入的数据和统计并排序的数据进行保存.例如: voidsave() { fstreamoutfile; ("f: ",ios: : app); if(! outfile) { cout<<"fcan'topen.\n"; abort(); } outfile<<"Salesmanger"< outfile<<"ID"< } 5.Eixt(退出): 利用exit来完成退出系统功能。 四、设计和调试分析 程序清单: #include<> #include<> #include<> #include<> #include<> classemployee { public: employee() { salary=0; } voidpay(){} voidprint(){} voidinput() { cout<<"ID: "; cin>>no; cout<<"NAME: "; cin>>name; cout<<"SEX(m/w): "; cin>>sex; cout<<"AGE: "; cin>>age; } protected: intno; charname[8]; floatsalary; charsex; intage; }; classmanager: virtualpublicemployee { protected: floatmonthlypay,sale; public: manager(){monthlypay=8000;} voidinput(){cout<<"Manger";employee: : input();} voidsave() { fstreamoutfile; ("f: ",ios: : app); if(! outfile) { cout<<"fcan'topen.\n"; abort(); } outfile<<"Manger"< outfile<<"ID"< } voidpay(){salary=monthlypay;} voidprint() { cout<<"├─────┼─────┼─────┼─────┼─────┤"< cout<<"│"< <<"│"< } }; classtechnician: virtualpublicemployee { private: floathourlyrate; intworkhours; public: technician(){hourlyrate=100;} voidpay() { cout< "; cin>>workhours; salary=hourlyrate*workhours; } voidinput(){cout<<"TECHNICIAN"< : input();} voidsave() { fstreamoutfile; ("f: ",ios: : app); if(! outfile) { cout<<"fcan'topen.\n"; abort(); } outfile<<"TECHNICIAN"< outfile<<"ID"< } voidprint() { cout<<"├─────┼─────┼─────┼─────┼─────┤"< cout<<"│"< <<"│"< } }; classsalesman: virtualpublicemployee { protected: floatcommrate; floatsales; public: salesman(){commrate=;} voidinput(){cout<<"SALEMAN";employee: : input();} voidsave() { fstreamoutfile; ("f: ",ios: : app); if(! outfile) { cout<<"fcan'topen.\n"; abort(); } outfile<<"TECHNICIAN"< outfile<<"ID"< } voidpay() { cout< "; cin>>sales; salary=sales*commrate; } voidprint() { cout<<"├─────┼─────┼─────┼─────┼─────┤"< cout<<"│"< < } }; classsalesmanager: virtualpublicmanager,virtualpublicsalesman { private: floattotal;intno1,no2,no3,no4;charname1[8],name2[8],name3[8],name4[8]; floatsale1,sale2,sale3,sale4; public: voidsalemanager() { monthlypay=5000; commrate=; } voidinput(){cout<<"Salesmanger";employee: : input();} voidsave() { fstreamoutfile; ("f: ",ios: : app); if(! outfile) { cout<<"fcan'topen.\n"; abort(); } outfile<<"Salesmanger"< outfile<<"ID"< } voidsavesale() { fstreamoutfile; ("f: ",ios: : app); if(! outfile)
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 小型企业 工资管理 系统