小型公司工资管理系统设计

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

目录一、课程设计目的.........................................1二、课程设计内容..........................................11、题目及简介..........................................12、设计说明............................................13、程序设计...........................................1(1)程序流程图.....................................1(2)程序代码.......................................2三、课程设计总结..........................................15参考文献.................................................15一、课程设计目的(1)要求学生达到熟练掌握c++语言的基本知识和技能;(2)基本掌握面向对象程序设计的基础思路和方法;(3)能够利用所学的基本知识和技能,解决简单的面向对象程序设计问题。二、课程设计内容1、题目及简介(1)设计题目:小型公司工资管理系统设计(2)简介:公司主要有4类人员:经理,技术员,销售员,销售经理。要求存储这些人的职工号,姓名,月工资,岗位,年龄,性别等信息。工资的计算方法:经理:固定月薪为8000;技术员:工作时间*小是工资(100元每小时);销售员:销售额*4%提成;销售经理:底薪(5000)+所辖部门销售额总额*0.5%;要求;1)输入数据要求每类人员不能少于4人,并按一下格式输出:职员号姓名性别年龄岗位工资排名及某销售经理管理所辖部门各销售员的业绩及自己的工资表:职员号姓名销售额销售额合计。2)总体设计,要有一个菜单,用于选择各项功能,其中(1)数据录入:输入各种数据;(2)数据统计:各销售经理的工资计算及最终按工资进行的冒泡排序;(3)数据打印:打印上述表格;(4)退出:退出本系统;2设计说明充分利用了类的继承与派生的知识,先定义了一个雇员类Employee,由雇员类公有派生出技术员类Tech,销售员类Seller,经理类Manager,由销售员类Seller,经理类Manager公有派生出销售经理类XManager。把基类都定义为虚基类。通过基类去写的派生类就可以调基类的公有成员。利用for循环把经理数据,技术员数据,销售员数据,销售经理数据输入,利用冒泡排序法把各销售经理的资按升序排列。利用switch进行选择系统进行的工作。在主菜单中进行调用各函数,从而实现系统各功能的运行。3程序设计(1)程序流程图开始主函数输入ii=1录入i=2统计i=3打印i=4退出InputMenu()输入ii=1Manager类i=2Tech类i=3Seller类i=4XManager类i=5返回结束雇员类技术员类经理类销售员类类销售经理类(2)程序代码#includeiostream.h#includestring.h#includeiomanip.hclassEmployee//雇员类{protected:intnum;intage;charname[10];doubleincome;charsex;public:virtualvoidSet(){cout其姓名:;cinname;cout性别(m/w):;cinsex;cout年龄:;cinage;}voidGet(){cout┣━━━━━╋━━━━━╋━━━━━╋━━━━━╋━━━━━┫endl;cout┃setw(10)num┃;intn=10-strlen(name);for(inti=0;in;i++)cout;coutname┃sex┃setw(10)age┃setw(10)income┃endl;}};classTech:virtualpublicEmployee//技术员类{protected:doublehour;doubleper;public:voidSet(){cout技术员编号:;cinnum;coutendl;Employee::Set();coutendl;cout工作时间:;cinhour;per=100;income=hour*per;}};classSeller:virtualpublicEmployee//销售员类{protected:doublesalary;//销售额intss;//所属经理编号public:doubleGets(){returnsalary;}voidSet(){cout销售员编号:;cinnum;Employee::Set();cout销售额:;cinsalary;cout所属经理编号:;cinss;income=salary*0.04;}voidGet1(){intn=10-strlen(name);cout┃setw(12)num┃;for(inti=0;in;i++)cout;coutname┃setw(12)salary┃endl;}};classManager:virtualpublicEmployee//经理类{protected:public:voidSet(){cout经理的编号:;cinnum;Employee::Set();income=8000;}};classXmanager:virtualpublicManager,publicSeller//销售经理类{protected:Sellerc1;//销售员Sellerc2;//销售员doubletotals;//销售总额public:doublereturnt(){returntotals;}voidSetc(){c1.Set();coutendl;c2.Set();coutendl;}voidSet(){cout销售经理编号:;cinnum;Employee::Set();totals=c1.Gets()+c2.Gets();income=5000+totals*0.005;}voidGetx(){cout┣━━━━━╋━━━━━╋━━━━━╋━━━━━╋━━━━━┫endl;cout┃setw(10)num┃;intn=10-strlen(name);for(inti=0;in;i++)cout;coutname┃sex┃setw(10)age┃setw(10)income┃endl;}voidGet1(){cout职工编号num销售经理name下属销售员的业绩为:endl;cout┏━━━━━━┳━━━━━┳━━━━━━┓endl;cout┃职工号┃姓名┃销售额┃endl;cout┣━━━━━━╋━━━━━╋━━━━━━┫endl;c1.Get1();cout┣━━━━━━╋━━━━━╋━━━━━━┫endl;c2.Get1();cout┣━━━━━━╋━━━━━┻━━━━━━┫endl;cout┃销售额总计:┃setw(23)totals┃endl;cout┗━━━━━━┻━━━━━━━━━━━━┛endl;}voidGetc(){c1.Get();c2.Get();}};voidtou()//输出表格头部{cout┏━━━━━┳━━━━━┳━━━━━┳━━━━━┳━━━━━┓endl;cout┃职工号┃姓名┃性别┃年龄┃工资┃endl;}voidwei()//输出表格尾部{cout┗━━━━━┻━━━━━┻━━━━━┻━━━━━┻━━━━━┛endl;}ManagerA[4];//定义全局对象TechB[4];XmanagerD[4];inti;//变量intInputManager(){for(i=0;i4;i++){A[i].Set();coutendl;}cout-------------------------------------------endl;return0;}intInputTech(){for(i=0;i4;i++){B[i].Set();coutendl;}cout-------------------------------------------endl;return0;}intInputSeller(){for(i=0;i4;i++){D[i].Setc();coutendl;}cout-------------------------------------------endl;return0;}intInputXManager(){for(i=0;i4;i++){D[i].Set();coutendl;}cout-------------------------------------------endl;return0;}intfanhui()//冒泡排序法{for(intpass=1;pass4;pass++){for(i=0;i4-pass;i++)if(D[i].returnt()D[i+1].returnt()){Xmanagertemp;temp=D[i];D[i]=D[i+1];D[i+1]=temp;}}return0;}intIntputMenu(){cout☆★小型公司工资管理系统★☆endl;cout┏━━━━━━━━━━━━━━━━┓endl;cout┃请选择您所需要的操作┃endl;cout┃经理数据输入:1,并按回车键┃endl;cout┃技术员数据输入:2,并按回车键┃endl;cout┃销售员数据输入:3,并按回车键┃endl;cout┃销售经理数据输入:4,并按回车键┃endl;cout┃返回上一层:5,并按回车┃endl;cout┗━━━━━━━━━━━━━━━━┛endl;cout请选择一个操作:;cini;switch(i){case1:InputManager();break;case2:InputTech();break;case3:InputSeller();break;case4:InputXManager();break;case5:fanhui();return0;break;}return1;}intStatisticMenu()//数据统计{for(i=0;i4;i++){D[i].Get1();coutendl;}coutendl;cout销售经理按工资排序为:endl;tou();for(i=0;i4;i++)D[i].Getx();wei();return0;}intPrintMenu(){cout请等待...............endl;cout职工基本情况一览表如下:endl;cout技术员endl;tou();for(i=0;i4;i++)B[i].Get();wei();cout--------------------------------------------------------------endl;cout经理endl;tou();for(i=0;i4;i++)A[i].Get();wei()

1 / 16
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功