C++小型企業(yè)工資管理系統(tǒng)_第1頁(yè)
C++小型企業(yè)工資管理系統(tǒng)_第2頁(yè)
C++小型企業(yè)工資管理系統(tǒng)_第3頁(yè)
已閱讀5頁(yè),還剩7頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、1. 一、需求分析從要求上來(lái)看是要對(duì)各個(gè)員工的各種情況(名字、年齡、性別、職位、工資狀況)進(jìn)行輸入。然后可以輸出.2. 可以對(duì)于員工數(shù)據(jù)進(jìn)行修改,可以查詢.3. 對(duì)于員工的各種情況系統(tǒng)還可以進(jìn)行統(tǒng)計(jì)排名.二、概要設(shè)計(jì)首先,創(chuàng)建了一個(gè)employee類.然后派生出四個(gè)類:managertechnician、salesman、salesmanager.在派生類中定義了三個(gè)構(gòu)造函數(shù)分別是:數(shù)據(jù)輸入函數(shù)(Input),表格輸出函數(shù)(Print),排序函數(shù)(Pay).其次,在總體結(jié)構(gòu)上,建立以各根菜單,用于選擇各種功能.1. Input(數(shù)據(jù)輸入):輸入員工的各種數(shù)據(jù).2. Total(數(shù)據(jù)統(tǒng)計(jì)):將員

2、工的總數(shù)據(jù)進(jìn)行對(duì)比排序,然后輸出.3. Output(數(shù)據(jù)顯示):顯示輸入的各種數(shù)據(jù).4. Save(數(shù)據(jù)保存):對(duì)輸入的數(shù)據(jù)進(jìn)行保存?zhèn)浞?5. Eixt(退出程序):執(zhí)行退出程序命令.1. 三、詳細(xì)設(shè)計(jì)Input(數(shù)據(jù)輸入):定義了各個(gè)崗位的人員的類,并把每個(gè)類的人員的屆性設(shè)為類中的保護(hù)成員,其中技術(shù)工的工作時(shí)間和每小時(shí)的所得為私有成員,而銷售員的銷售額、經(jīng)理的工資和銷售經(jīng)理的所轄部門(mén)的銷售額和其底薪設(shè)為公有成員,再依次錄入。Total(數(shù)據(jù)統(tǒng)計(jì)):根據(jù)所有類的工資算法在其所屆類中定義一個(gè)函數(shù)voidpay()來(lái)根據(jù)各個(gè)職位的具體情況來(lái)計(jì)算工資,并且算出的工資經(jīng)過(guò)冒泡法排序.voidprin

3、ttotal()(cout<<""<<endl;cout<<"Total"<<setw(10)<<total<<""<<endl;cout<<""<<endl;Output(數(shù)據(jù)顯示):通過(guò)do-while循環(huán)以及制表格和setw的使用將輸入的數(shù)據(jù)和統(tǒng)計(jì)并排序的數(shù)據(jù)以表格的形式打印出來(lái),銷售額合計(jì)一欄寬度要大些。voidsaleprint()(cout<<"I"<<

4、setw(10)<<no1<<"I"<<setw(10)<<name1<<"I"<<setw(10)<<sale1<<"|"<<endl;cout<<"|111"<<endl;cout<<"|"<<setw(10)<<no2<<"|"<<setw(10)<<name2<

5、<"|"<<setw(10)<<sale2<<"|"<<endl;cout<<"|111"<<endl;cout<<"|"<<setw(10)<<no3<<"|"<<setw(10)<<name3<<"|"<<setw(10)<<sale3<<"I"<&l

6、t;endl;cout<<"|111"<<endl;cout<<"|"<<setw(10)<<no4<<"|"<<setw(10)<<name4<<"|"<<setw(10)<<sale4<<"|"<<endl;voidprint()(cout<<"|111I1"<<endl;2. cout<

7、<"|"<<setw(10)<<no<<"|"<<setw(10)<<name<<"|"<<setw(10)<<sex<<"|<<setw(10)<<age<<"|"<<setw(10)<<salary<<"<<endl;Save(數(shù)據(jù)保存):通過(guò)函數(shù)save()來(lái)將輸入的數(shù)據(jù)和統(tǒng)計(jì)并排序的數(shù)據(jù)進(jìn)行保

8、存.例如:voidsave()fstreamoutfile;outfile.open("f:flsdfj.txt",ios:app);if(!outfile)cout<<"fcan'topen.n"abort();outfile<<"Salesmanger"<<endl;outfile<<"ID"<<no<<"NAME"<<name<<"SEX"<<sex<

9、;<"AGE"<<age<<"SALARY"<<salary<<endl;3. Eixt(退出):利用exit來(lái)完成退出系統(tǒng)功能。四、設(shè)計(jì)和調(diào)試分析程序活單:#include<iostream.h>#include<stdlib.h>#include<fstream.h>#include<iomanip.h>#include<string.h>classemployeepublic:employee()salary=0;voidpay()vo

10、idprint()voidinput()cout<<"ID:"cin>>no;cout<<"NAME:"cin>>name;cout<<"SEX(m/w):"cin>>sex;cout<<"AGE:"cin>>age;protected:intno;charname8;floatsalary;charsex;intage;;classmanager:virtualpublicemployeeprotected:float

11、monthlypay,sale;public:manager()monthlypay=8000;voidinput()cout<<"Manger”;employee:input();voidsave()fstreamoutfile;outfile.open("f:flsdfj.txt”,ios:app);if(!outfile)cout<<"fcan'topen.n"abort();outfile<<"Manger"<<endl;outfile<<"ID&q

12、uot;<<no<<"NAME"<<name<<"SEX"<<sex<<"AGE"<<age<<"SALARY"<<salary<<endl;voidpay()salary=monthlypay;voidprint()cout<<"|111I1"<<endl;cout<<"I"<<setw(10)<<

13、;no<<"|"<<setw(10)<<name<<"|<<"|"<<setw(10)<<age<<"|"<<setw(10)<<salary<<<<endl;classtechnician:virtualpublicemployeeprivate:floathourlyrate;intworkhours;public:technician()hourlyrate=100;voidp

14、ay()cout<<name<<"Workhour:"cin>>workhours;salary=hourlyrate*workhours;voidinput()cout<<"TECHNICIAN"<<endl;employee:input();voidsave()fstreamoutfile;outfile.open("f:flsdfj.txt”,ios:app);if(!outfile)cout<<"fcan'topen.n"abort();

15、outfile<<"TECHNICIAN"<<endl;outfile<<"ID"<<no<<"NAME"<<name<<"SEX"<<sex<<"AGE"<<age<<"SALARY"<<salary<<endl;voidprint()cout<<"|111I1"<<endl;

16、cout<<"I"<<setw(10)<<no<<"|"<<setw(10)<<name<<"I<<"|"<<setw(10)<<age<<"|"<<setw(10)<<salary<<"|"<<endl;classsalesman:virtualpublicemployeeprotected:floatco

17、mmrate;floatsales;public:salesman()commrate=0.04;voidinput()cout<<"SALEMAN"employee:input();voidsave()fstreamoutfile;outfile.open("f:flsdfj.txt",ios:app);if(!outfile)cout<<"fcan'topen.n"abort();outfile<<"TECHNICIAN"<<endl;outfile<

18、;<"ID"<<no<<"NAME"<<name<<"SEX"<<sex<<"AGE"<<age<<"SALARY"<<salary<<endl;voidpay()cout<<name<<"Salesvolume:"cin>>sales;salary=sales*commrate;voidprint()cout<

19、;<"|111I1"<<endl;cout<<"|"<<setw(10)<<no<<"|"<<setw(10)<<name<<”|<<sex<<"|"<<setw(10)<<age<<”|"<<setw(10)<<salary<<"|"<<endl;classsalesmanag

20、er:virtualpublicmanager,virtualpublicsalesmanprivate:floattotal;intno1,no2,no3,no4;charname18,name28,name38,name48;floatsale1,sale2,sale3,sale4;public:voidsalemanager()monthlypay=5000;commrate=0.005;voidinput()(cout<<"Salesmanger"employee:input();voidsave()(fstreamoutfile;outfile.ope

21、n("f:flsdfj.txt",ios:app);if(!outfile)(cout<<"fcan'topen.n"abort();outfile<<"Salesmanger"<<endl;outfile<<"ID"<<no<<"NAME"<<name<<"SEX"<<sex<<"AGE"<<age<<&

22、quot;SALARY"<<salary<<endl;voidsavesale()(fstreamoutfile;outfile.open("f:flsdfj.txt",ios:app);if(!outfile)(cout<<"fcan'topen.n"abort();outfile<<"Thesalaryofsalemanofsalesmangerandthemselves"<<endl;outfile<<"ID"<&

23、lt;no1<<"NAME"<<name1<<"SALARY"<<sale1<<endl;outfile<<"ID"<<no2<<"NAME"<<name2<<"SALARY"<<sale2<<endl;outfile<<"ID"<<no3<<"NAME"<<name

24、3<<"SALARY"<<sale3<<endl;outfile<<"ID"<<no4<<"NAME"<<name4<<"SALARY"<<sale4<<endl;voidpay()(cout<<name<<"Thesalesvolumeofeverydepartment:"salary=monthlypay+commrate*total;floatto

25、talsale()total=sale1+sale2+sale3+sale4;returntotal;voidprinttotal()cout<<"|1111"<<endl;cout<<"|Total|"<<setw(10)<<total<<”"<<endl;cout<<"111"<<endl;voidsort(salesmanagerp)inttmp,i,j;for(j=0;j<2;j+)for(i=0;i&l

26、t;2;i+)if(total<p.salary)tmp=salary;total=p.salary;p.salary=tmp;tmp=no;no=p.no;p.no=tmp;voidsaler()cout«"StaffID:"cin»no1:cout«"StaffNAME:"cin»name1;cout«"Salesvolume:"cin»sale1:cout«"StaffID:"cin»no2;cout«"

27、StaffNAME:"cin»name2;cout«"Salesvolume:"cin»sale2;cout«"StaffID:"cin»no3;cout«"StaffNAME:"cin»name3;cout«"Salesvolume:"cin»sale3;cout«"StaffID:"cin»no4;cout«"StaffNAME:"cin

28、87;name4;cout«"Salesvolume:"cin»sale4;voidsaleprint()I"«setw(10)«name1«"cout«"|"«setw(10)«no1«""«setw(10)«sale1«"|"«endl;cout<<"|111"<<endl;cout<<"|&quo

29、t;<<setw(10)<<no2<<"|"<<setw(10)<<name2<<"|<<setw(10)<<sale2<<"|"<<endl;cout<<"|111"<<endl;cout<<"|"<<setw(10)<<no3<<"|"<<setw(10)<<name3

30、<<"|<<setw(10)<<sale3<<"|"<<endl;cout<<"|111"<<endl;cout<<"|"<<setw(10)<<no4<<"|"<<setw(10)<<name4<<"|<<setw(10)<<sale4<<"|"<<endl;v

31、oidprint()cout<<"|111k1"<<endl;cout<<"|"<<setw(10)<<no<<"|"<<setw(10)<<name<<"|<<setw(10)<<sex<<"|<<setw(10)<<age<<"|"<<setw(10)<<salary<<&quo

32、t;|"<<endl;voidmain()managerm4;techniciant4;salesmans4;salesmanagersm4;t1.save();intflag=1,operate;docout<<"#Thesystemofsalarymanger#n"cout<<"n"cout<<"IChoseyouractionsIn"cout<<"Input:1,EnterIn"cout<<"Total:2,Enter

33、In"cout<<"Output:3,EnterIn"cout<<"Save:4,EnterIn"cout<<"Exit:5,EnterIn"cout<<"1n"cout<<"Pleasechoseoneaction:"cin>>operate;switch(operate)(case1:cout<<"Waitingforaminute!"<<endl;(for(inti

34、=0;i<4;i+)mi.input();for(intj=0;j<4;j+)tj.input();for(intk=0;k<4;k+)sk.input();for(intl=0;l<4;l+)sml.input();for(inti=0;i<4;i+)mi.pay();for(intj=0;j<4;j+)tj.pay();for(intk=0;k<4;k+)sk.pay();for(intl=0;l<4;l+)sml.pay();sml.saler();break;case2:cout<<"Waitingforaminut

35、e!"<<endl;for(intl=0;l<4;l+)sml.totalsale();for(inti=0;i<4;i+)for(intj=0;j<2;j+)smj.sort(smj+1);cout<<"Thesalemanofthefirstsalesmanger"<<endl;cout<<"i111"<<endl;cout<<"|ID|NAME|SALARY|"<<endl;sm0.saleprint();sm0.pr

36、inttotal();cout<<"Theorderiscomplete"<<endl;cout<<"Listnamesofeverysalesmanger"<<endl;cout<<"i111-n1"<<endl;cout<<"|ID|NAME|SEX|AGEISALARY|"<<endl;for(intk=0;k<4;k+)smk.print();cout<<"11111"<

37、;<endl;break;case3:cout«"Waitingforaminute!"«endl;cout«"Theblankofthe:"«endl;cout«"i111i1"«endl;cout«"|ID|NAME|SEX|AGEISALARY|"«endl;for(inti=0;i<4;i+)mi.print();)cout«"11111"«endl;COUt«&qu

38、ot;I111i1"«endl;cout«"11111"«endl;COUt«"I111i1"«endl;cout«"|ID|NAME|SEX|AGEISALARY|"«endl;for(intk=0;k<4;k+)sk.print();)cout«"11111"«endl;COUt«"I111i1"«endl;cout«"11111"

39、71;endl;);break;case4:cout«"Waitingforaminute!"«endl;for(inti=0;i<4;i+)mi.save();for(intj=0;j<4;j+)tj.save();for(intk=0;k<4;k+)sk.save();for(intl=0;l<4;l+)sml.save();cout<<"Informationsave!"<<endl;break;case5:exit(0);break;default:cout<<"Error!Repeatagain!"<<endl;while(flag=1);五、用戶手冊(cè)1)運(yùn)行程序.會(huì)出現(xiàn)如下畫(huà)面,按照提示進(jìn)行選擇.3SChos«actionsInput;t«EnterTo

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論