《面向对象程序设计》课程设计报告
来源:互联网 发布:免费爆粉软件 编辑:程序博客网 时间:2024/05/24 05:17
题目:小型公司工资管理系统
功能:
1、公司各部门员工信息分类录入;
2、公司销售部工资情况查询;(分类各销售经理下属销售员情况)
3、公司总体工资情况查询;
要求:
实现一个工资管理系统,系统的主要功能是计算职工当月工资并要求存档案。
公司是一个不大不小公司,职工有种5类型,他们是技术人员,销售人员,文秘,技术经理,销售经理。世界从来就不是公平的,在公司内部也一样,不同职位工资不同。
技术人员工资是按小时算,薪酬为40元。销售人员工资是按销售提成,月工资为销售总额的5%。文秘为有4000元底薪,奖金要看当月的工作情况而定。技术经理和销售经理,均有每月5000元固定工资。技术经理工作业绩分为三个等级,每级有1000元奖金,销售经理资金由他管理团队销售业绩而定,为总经额的0.3%。
分析:
技术人员 工作小时*时薪40元
销售人员 销售总额的5%
文秘 4000底薪+奖金
技术经理 5000底薪+奖金(1000-3000)
销售经理 5000底薪+总经额0.3%
先定义一个雇员类Employee,由雇员类公有派生出技术员类Tech,销售员类Seller,文秘类Secretary和技术经理类YManager,再由销售员类Seller公有派生出销售经理类XManager。把基类都定义为虚基类。通过基类去写的派生类就可以调基类的公有成员。利用for循环把文秘数据,技术员数据,销售员数据,技术经理数据和销售经理数据输入,利用switch进行选择系统进行的工作。在主菜单中进行调用各函数,从而实现系统各功能的运行。
不足:
这个程序有挺多不足的地方啊。。。
首先是题目要求——文秘和技术经理的工资是由底薪还有奖金组成的,但由于我不知道怎么理解这个奖金,所以程序里没有实现这个功能。
员工信息的录入方面,没有删除错误录入信息的功能,万一录入信息错误必须重新录入此类全部员工的信息。并且程序很硬性地规定要录入4名文秘、4名技术员、8名销售员、4名技术经理、4名销售经理的信息,其中每名销售经理旗下有2名销售员。最后展示情况的表格也是根据这个数量设置的。
还有一个我一开始没有发现的漏洞,一开始设置了销售员有“所属销售经理编号”的输入,本来想根据这个编号归类销售员的,但由于后来不知道怎么实现,所以没去管它。结果导致销售员的归类与所输入的“所属销售经理编号”无关,第1、2个输入的销售员信息默认归类到第1个输入的销售经理旗下,以此类推。
代码:
#include<iostream.h>#include<string.h>#include<iomanip.h>class Employee//雇员类{protected:int number;int age;char name[10];double income;char sex;public:virtual void Set(){ cout<<"姓名:";cin>>name;cout<<"性别(m/w):";cin>>sex;cout<<"年龄:";cin>>age;}void Get(){ cout<<"┣━━━━━╋━━━━━╋━━━━━╋━━━━━╋━━━━━┫"<<endl;cout<<"┃"<<setw(10)<<number<<"┃";int n=10-strlen(name);for(int i=0;i<n;i++)cout<<" ";cout<<name<<"┃"<<" "<<sex<<" "<<"┃"<<setw(10)<<age<<"┃"<<setw(10)<<income<<"┃"<<endl;}};//*****************************************************class Tech:virtual public Employee//技术员类{protected: double hour; double per;public:void Set(){ cout<<endl;cout<<"技术员编号:";cin>>number;Employee::Set();cout<<"工作时间:";cin>>hour;per=40;income=hour*per;} };//*****************************************************class Seller: virtual public Employee//销售员类{protected:double salary;//销售额int ss;//所属销售经理编号public:double Gets() { return salary;} void Set(){ cout<<endl;cout<<"销售员编号:";cin>>number;Employee::Set();cout<<"销售额:";cin>>salary;cout<<"所属销售经理编号:";cin>>ss;income=salary*0.05;}void Get1(){ int n=10-strlen(name);cout<<"┃"<<setw(12)<<number<<"┃";for(int i=0;i<n;i++) cout<<" ";cout<<name<<"┃"<<setw(12)<<salary<<"┃"<<endl;}};//*****************************************************class Secretary:virtual public Employee//文秘类{protected:public:void Set(){ cout<<endl;cout<<"文秘的编号:";cin>>number;Employee::Set();income=4000;}};//*****************************************************class Ymanager:virtual public Employee//技术经理类{protected:public:void Set(){ cout<<endl;cout<<"技术经理的编号:";cin>>number;Employee::Set();income=5000;}};//*****************************************************class Xmanager:virtual public Seller//销售经理类{protected:Seller c1;//销售员Seller c2;//销售员double totals;//销售总额public:double returnt() {return totals;}void Setc(){ c1.Set();cout<<endl;c2.Set();cout<<endl;}void Set(){ cout<<endl;cout<<"销售经理编号:";cin>>number;Employee::Set();totals=c1.Gets()+c2.Gets();income=5000+totals*0.003;}void Getx(){ cout<<"┣━━━━━╋━━━━━╋━━━━━╋━━━━━╋━━━━━┫"<<endl;cout<<"┃"<<setw(10)<<number<<"┃";int n=10-strlen(name);for(int i=0;i<n;i++)cout<<" ";cout<<name<<"┃"<<" "<<sex<<" "<<"┃"<<setw(10)<<age<<"┃"<<setw(10)<<income<<"┃"<<endl;}void Get1(){ cout<<"职工编号"<<number<<"销售经理"<<name<<"下属销售员的业绩为:"<<endl;cout<<"┏━━━━━━┳━━━━━┳━━━━━━┓"<<endl;cout<<"┃"<<" 职工号 "<<"┃"<<" 姓名 "<<"┃"<<" 销售额 "<<"┃"<<endl;cout<<"┣━━━━━━╋━━━━━╋━━━━━━┫"<<endl;c1.Get1();cout<<"┣━━━━━━╋━━━━━╋━━━━━━┫"<<endl;c2.Get1();cout<<"┣━━━━━━╋━━━━━┻━━━━━━┫"<<endl;cout<<"┃"<<"销售额总计:"<<"┃"<<setw(23)<<totals<<" ┃"<<endl;cout<<"┗━━━━━━┻━━━━━━━━━━━━┛"<<endl;}void Getc(){ c1.Get();c2.Get();}};//*****************************************************void beginning()//输出表格头部{cout<<"┏━━━━━┳━━━━━┳━━━━━┳━━━━━┳━━━━━┓"<<endl;cout<<"┃"<<" 职工号 "<<"┃"<<" 姓名 "<<"┃"<<" 性别 "<<"┃"<<" 年龄 "<<"┃"<<" 工资 "<<"┃"<<endl;}void end()//输出表格尾部{cout<<"┗━━━━━┻━━━━━┻━━━━━┻━━━━━┻━━━━━┛"<<endl;}//*****************************************************Secretary A[4]; //定义全局对象Tech B[4];Ymanager D[4];Xmanager E[4];int i; //变量int InputSecretary(){for(i=0;i<4;i++) {A[i].Set();cout<<endl;}cout<<"-------------------------------------------"<<endl;return 0;}int InputTech (){for(i=0;i<4;i++) {B[i].Set();cout<<endl;}cout<<"-------------------------------------------"<<endl;return 0;}int InputYManager(){for(i=0;i<4;i++) {D[i].Set();cout<<endl;}cout<<"-------------------------------------------"<<endl;return 0;}int InputSeller(){for(i=0;i<4;i++) {E[i].Setc();cout<<endl;}cout<<"-------------------------------------------"<<endl;return 0;}int InputXManager(){for(i=0;i<4;i++) {E[i].Set();cout<<endl;}cout<<"-------------------------------------------"<<endl;return 0;}//*****************************************************int Sort()//冒泡排序法{ for(int pass=1;pass<4;pass++){ for(i=0;i<4-pass;i++)if(E[i].returnt()<E[i+1].returnt()){ Xmanager temp;temp=E[i];E[i]=E[i+1];E[i+1]=temp;}} return 0;}//*****************************************************int IntputMenu(){ cout<<endl<<endl;cout<<" *******小型公司工资管理系统*******"<<endl;cout<<" ┏━━━━━━━━━━━━━━━━┓"<<endl;cout<<" ┃ 请选择您所需要的操作 ┃"<<endl;cout<<" ┃ 文秘数据输入 : 1,并按回车键 ┃"<<endl;cout<<" ┃ 技术员数据输入 : 2,并按回车键 ┃"<<endl;cout<<" ┃ 销售员数据输入 : 3,并按回车键 ┃"<<endl;cout<<" ┃ 技术经理数据输入: 4,并按回车键 ┃"<<endl;cout<<" ┃ 销售经理数据输入: 5,并按回车键 ┃"<<endl;cout<<" ┃ 返回上一层 : 6,并按回车 ┃"<<endl;cout<<" ┗━━━━━━━━━━━━━━━━┛"<<endl;cout<<endl;cout<<"请选择一个操作: ";cin>>i;switch(i) { case 1:InputSecretary(); break;case 2:InputTech (); break;case 3:InputSeller();break; case 4:InputYManager();break;case 5:InputXManager();break;case 6: Sort();return 0;break;} return 1;}//*****************************************************int StatisticMenu()//数据统计{for(i=0;i<4;i++){E[i].Get1();cout<<endl;}cout<<endl;cout<<"销售经理按工资排序为:"<<endl;beginning ();for(i=0;i<4;i++)E[i].Getx();end();return 0;}int PrintMenu(){cout<<"请等待..............."<<endl;cout<<"职工基本情况一览表如下:"<<endl;cout<<"技术员"<<endl;beginning ();for(i=0;i<4;i++)B[i].Get();end ();cout<<"--------------------------------------------------------------"<<endl; cout<<"文秘"<<endl;beginning ();for(i=0;i<4;i++)A[i].Get();end ();cout<<"--------------------------------------------------------------"<<endl;cout<<"技术经理"<<endl;beginning ();for(i=0;i<4;i++)D[i].Get();end ();cout<<"--------------------------------------------------------------"<<endl; cout<<"销售经理"<<endl;beginning ();for(i=0;i<4;i++) E[i].Get();end (); cout<<"------------------------------------------------------------"<<endl;cout<<"销售员"<<endl;beginning ();for(i=0;i<4;i++)E[i].Getc();end (); cout<<"------------------------------------------------------------------"<<endl;return 0;}//*****************************************************int Showmenu(){while(1) { cout<<endl; cout<<" ***小型公司工资管理系统***"<<endl;cout<<" ┏━━━━━━━━━━━━┓"<<endl;cout<<" ┃ 请选择您所需要的操作 ┃"<<endl;cout<<" ┃ 数据录入: 1,并按回车键 ┃"<<endl;cout<<" ┃ 销售情况: 2,并按回车键 ┃"<<endl;cout<<" ┃ 总体情况: 3,并按回车键 ┃"<<endl;cout<<" ┃ 退出系统: 4,并按回车键 ┃"<<endl;cout<<" ┗━━━━━━━━━━━━┛"<<endl;cout<<endl;cout<<"请选择一个操作: ";cin>>i;switch(i){ case 1:IntputMenu();break;case 2:StatisticMenu();break; case 3:PrintMenu();break;case 4:return 0;break;}}}void main(){ Showmenu();}
- 《面向对象程序设计》课程设计报告
- 《面向对象程序设计》课程设计报告 题目:《记忆测试系统》课程设计
- 2012 面向对象程序设计 课程设计题目及要求
- java面向对象课程设计
- Java面向对象程序设计 java实验报告第三个
- C++面向对象程序设计
- 面向对象程序设计
- 面向对象程序设计总结
- 面向对象程序设计概念
- 面向对象的程序设计
- 面向对象程序设计
- C++面向对象程序设计
- 面向对象程序设计
- 面向对象程序设计思想
- 面向对象的程序设计
- 面向对象程序设计
- 面向对象程序设计原则
- 面向对象/过程程序设计
- 小米手机连不上android studio
- 据说这是设计大牛整理的一份设计人员必看文章,不晓得对你是否有用
- spring中同一个定时任务执行两遍
- 观察者模式
- java ImageIO处理图像的封装
- 《面向对象程序设计》课程设计报告
- MyEclipse10 中的两种FreeMarker插件的安装与配置
- cas学习博客地址
- 关于QT利用setStyleSheet为主控件添加背景图片,而不影响其子控件的背景设置
- JAVA UUID 生成
- 从Unity引擎过度到Unreal4引擎
- 快速傅里叶变化C++实现
- 如何将eclipse导出的doc文档转换为chm格式
- 最简单的基于FFmpeg的推流器(以推送RTMP为例)