小型公司工資管理系統(tǒng)__(完結)_第1頁
小型公司工資管理系統(tǒng)__(完結)_第2頁
小型公司工資管理系統(tǒng)__(完結)_第3頁
小型公司工資管理系統(tǒng)__(完結)_第4頁
已閱讀5頁,還剩31頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領

文檔簡介

1、.中國石油大學 (華東)信息與控制工程學院程序設計實習 報告小型公司工資管理系統(tǒng)的設計姓名:Yuppies Liu時間:.專業(yè) .專注.2011年7月.專業(yè) .專注.目錄123101617.專業(yè) .專注.一、實習內容1 題目:小型公司管理系統(tǒng)的設計設計2.設計說明與基本要求(1) 公司主要有 4 類人員 :經理、技術員、銷售員、銷售經理 。 要求存儲這些人的職工號 、姓名、月工資、年齡、性別等信息 。(2) 工資的計算方法A 經理:固定月薪為 8000 元;B 技術員:工作時間 *小時工資 (100 元 / 小時);C 銷售員:銷售額 *4% 提成;D 銷售經理 :底薪(5000 元)+ 所轄

2、部門銷售額總額 *0.5%。(3) 員工基本數(shù)據(jù)的輸入要求每類人員不能少于4 人,其中銷售員需要8 名,每名銷售經理手下有 名銷售員 。(4) 各類的數(shù)據(jù)成員訪問權限設置為 :protected 3.實現(xiàn)基本功能(1) 數(shù)據(jù)輸入 :輸入各種數(shù)據(jù)(2) 數(shù)據(jù)的輸入 :統(tǒng)計各銷售經理下屬銷售員的銷售額及銷售額之和 ;銷售經理按工資進行的帽泡排序 ;(3) 數(shù)據(jù)打印 :打印各類員工的數(shù)據(jù)信息 ;(4) 數(shù)據(jù)備份(5) 退出:退出本系統(tǒng)備注:可適當擴充程序功能 ,功能擴充得當可加分.專業(yè) .專注.4菜單說明(1)數(shù)據(jù)錄入指通過鍵盤輸入各類員工的各項數(shù)據(jù)(2)數(shù)據(jù)統(tǒng)計指統(tǒng)計各銷售經理下屬銷售員的銷售額及

3、銷售額之和;銷售經理按工資進行的冒泡排序(3) 數(shù)據(jù)的打印指按照表格的格式在屏幕上輸出各員工的數(shù)據(jù)信息(4) 數(shù)據(jù)的備份指把各類員工的數(shù)據(jù)信息寫入文件中保存(5)退出:結束程序的運行.專業(yè) .專注.二、設計思路在這個公司中有四類人員:經理、兼職技術人員 、銷售員要存儲的信息有姓名、編號、性別、年齡、工資、銷售額 、所屬經理編號 由于所有職員有相同的成員如編號 (num) 、姓名 (name) 、性別 (sex)、年齡 (age) 、工資 (wage) 。所以可將所有信息歸納為一個職員類(Guyuan), 將其作為一個基類,然后派生出子類,實現(xiàn)各類人員不同的信息(如工資計算 ),由于銷售經理具有

4、銷售員和經理的特性,所以銷售經理采用多重繼承的關系,繼承銷售員和經理的兩個類,為避免二義性將employee定義為虛基類 ,可用下圖表示 :題目中假設公司有2 名技術員 、4 名銷售員 、經理和銷售經理各 2 名,所以用對象數(shù)組的方式 ,利用循環(huán)語句來實現(xiàn)人員的輸入和輸出,整個程序設計如下:基類雇員類 :數(shù)據(jù)成員有職工號 、姓名、年齡、性別、月工資;成員函數(shù)只有姓名 、年齡、性別的設置函數(shù) 。技術員類 :繼承基類數(shù)據(jù)成員增加了工作時間;成員函數(shù)有設置函數(shù) 、構造函數(shù) 、輸出函數(shù)下屬函數(shù) 、備份函數(shù)下屬函數(shù) 。經理類:繼承基類數(shù)據(jù)成員未增加 ;成員函數(shù)有設置函數(shù) 、構造函數(shù) 、輸出函數(shù)下屬函數(shù)

5、、備份函數(shù)下屬函數(shù) 。銷售員類 :繼承基類.專業(yè) .專注.數(shù)據(jù)成員多了銷售額 、所屬經理編號 ;成員函數(shù)有設置函數(shù)、構造函數(shù) 、輸出函數(shù)下屬函數(shù)、備份函數(shù)下屬函數(shù)、銷售額返回函數(shù) 、所屬經理編號輸出函數(shù) 。銷售經理類 :繼承基類數(shù)據(jù)成員未增加 ;成員函數(shù)有設置函數(shù)、構造函數(shù) 、輸出函數(shù)下屬函數(shù)、備份函數(shù)下屬函數(shù)、統(tǒng)計函數(shù)所屬函數(shù) 。.專業(yè) .專注.三、程序代碼清單#include<iostream>#include<string>#include<iomanip>#include<fstream>using namespace std;ofstr

6、eam outfile("f1.txt",ios:out);class Guyuanpublic:int num,age;string name;char sex;int wage;class Jishuyuan: protected Guyuanpublic:int time;void set_jishuyuan()cout<<" 技術員編號 :" cin>>num; cout<<endl;cout<<" 其姓名 :" cin>>name;cout<<endl;

7、cout<<" 性別 (m/w):" cin>>sex;cout<<endl;cout<<" 年齡 :" cin>>age;cout<<endl;.專業(yè) .專注.cout<<" 工作時間 :" cin>>time;cout<<endl;wage=time*100;void show_jishuyuan()cout<<""<<setw(12)<<num<<&quo

8、t; "<<setw(12)<<name<<""<<setw(12)<<sex<<" "<<setw(12)<<age<<" "<<setw(12)<<wage<<" "<<endl;void show_jishuyuan4()outfile<<" "<<setw(12)<<num<<

9、" "<<setw(12)<<name<<""<<setw(12)<<sex<<" "<<setw(12)<<age<<" "<<setw(12)<<wage<<" "<<endl;class Jingli:protected Guyuanpublic:void set_jingli()cout<<" 經理的編號 :&q

10、uot; cin>>num;cout<<endl;cout<<" 其姓名 :" cin>>name;cout<<endl;cout<<" 其性別 (m/w):" cin>>sex;cout<<endl;cout<<" 年齡 :" cin>>age; cout<<endl;wage=8000;void show_jingli()cout<<""<<setw(12)

11、<<num<<" "<<setw(12)<<name<<""<<setw(12)<<sex<<" "<<setw(12)<<age<<" "<<setw(12)<<wage<<".專業(yè) .專注. "<<endl;void show_jingli4()outfile<<" "<<

12、;setw(12)<<num<<" "<<setw(12)<<name<<""<<setw(12)<<sex<<" "<<setw(12)<<age<<" "<<setw(12)<<wage<<" "<<endl;class Xiaoshouyuan:protected Guyuanpublic:void set_xi

13、aoshouyuan()cout<<" 銷售員的編號 :" cin>>num;cout<<endl;cout<<" 其姓名 :" cin>>name;cout<<endl;cout<<" 性別 (m/w):" cin>>sex;cout<<endl;cout<<" 年齡 :" cin>>age;cout<<endl;cout<<" 銷售額 :"

14、; cin>>sell;cout<<endl;cout<<" 所屬銷售經理的編號 :"cin>>belong;cout<<endl;wage=sell*4/100;void show_xiaoshouyuan()cout<<" "<<setw(14)<<num<<" "<<setw(14)<<name<<""<<setw(14)<<sell<&

15、lt;""<<endl;void show_xiaoshouyuan2()cout<<""<<setw(8)<<num<<""<<setw(8)<<name<<""<<setw(8)<<sex<<" "<<setw(8)<<age<<" "<<setw(8)<<wage<<&

16、quot;.專業(yè) .專注."<<setw(18)<<belong<<""<<endl;void show_xiaoshouyuan4()outfile<<" "<<setw(8)<<num<<" "<<setw(8)<<name<<""<<setw(8)<<sex<<" "<<setw(8)<<a

17、ge<<" "<<setw(8)<<wage<<""<<setw(18)<<belong<<""<<endl;int sell,belong;class Xiaoshoujingli:protected Guyuanpublic:int shu_jingli()return num;void set_xiaoshoujingli() cout<<" 銷售經理的編號 :"cin>>num;cout&

18、lt;<endl; cout<<" 其姓名 :"cin>>name;cout<<endl; cout<<" 性別 (m/w):"cin>>sex;cout<<endl; cout<<" 年齡 :"cin>>age; cout<<endl;void show_num()cout<<num;void show_name()cout<<name;void show_xiaoshoujingli()cout

19、<<" "<<setw(12)<<num<<" "<<setw(12)<<name<<""<<setw(12)<<sex<<" "<<setw(12)<<age<<" "<<setw(12)<<wage<<".專業(yè) .專注. "<<endl;void show_xiaosho

20、ujingli4()outfile<<" "<<setw(12)<<num<<" "<<setw(12)<<name<<""<<setw(12)<<sex<<" "<<setw(12)<<age<<" "<<setw(12)<<wage<<" "<<endl;void sho

21、w_wage()cout<<wage;void wage_sum(int sum)wage=5000+sum*0.5/100;void disp() cout<<" 小型公司工資管理系統(tǒng) "<<endl;cout<<""<<endl;cout<<" 請選擇您所需要的操作"<<endl;cout<<" 數(shù)據(jù)輸入 : 1,并按回車鍵 "<<endl;cout<<" 數(shù)據(jù)統(tǒng)計 : 2,并按回車

22、鍵 "<<endl;cout<<" 數(shù)據(jù)打印 : 3,并按回車鍵 "<<endl;cout<<" 數(shù)據(jù)備份 : 4,并按回車鍵 "<<endl;cout<<" 退出系統(tǒng) : 5,并按回車鍵 "<<endl;cout<<""<<endl;cout<<endl;cout<<" 請選擇一個操作 :".專業(yè) .專注.int main()const int n=2;

23、 int i,w;Jishuyuan an;Jingli bn;Xiaoshouyuan c2*n;Xiaoshoujingli dn;disp();while (1)cin>>w;switch(w)case 1: for(i=0;i<n;i+)ai.set_jishuyuan();cout<<"*"<<endl;for(i=0;i<n;i+)bi.set_jingli();cout<<"*"<<endl;for(i=0;i<(2*n);i+)ci.set_xiaoshouyu

24、an();cout<<"*"<<endl;.專業(yè) .專注.for(i=0;i<n;i+)di.set_xiaoshoujingli();cout<<"*"<<endl;disp();break;case 2: int sumn;int i,j;for(j=0;j<n;j+)sumj=0;cout<<"職 工號 為"dj.show_num();cout<<"銷售 經理"dj.show_name();cout<<"

25、下屬銷售員的業(yè)績?yōu)?: "<<endl;cout<<" "<<endl;cout<<" 職工號姓名銷售額"<<endl;for(i=0;i<2*n;i+)if(ci.belong=dj.shu_jingli()cout<<" "<<endl;ci.show_xiaoshouyuan();sumj=sumj+ci.sell;cout<<" "<<endl;cout<<" &

26、quot;<<" 銷售額總計 "<<setw(28)<<sumj<<".專業(yè) .專注."<<endl;cout<<" "<<endl;cout<<" 銷售經理按工資排序為 :"<<endl;cout<<" "<<endl;cout<<" 職工號姓名性別年齡工資"<<endl;Xiaoshoujingli x;double

27、y;for(i=0;i<n;i+)for(j=0;j<n;j+)if(sumi<sumi+1)x=di;di=dj;dj=x;y=sumi;sumi=sumj;sumj=y;for(i=0;i<n;i+) cout<<" "<<endl;di.wage_sum(sumi);di.show_xiaoshoujingli();cout<<" "<<endl;disp(); ;break;case 3: int i;.專業(yè) .專注.cout<<" 請等待 ."

28、;<<endl;cout<<" 職工基本情況一覽表如下"<<endl;cout<<" 技術員 "<<endl;cout<<" "<<endl;cout<<" 職工號姓名性別年齡工資"<<endl;for(i=0;i<n;i+) cout<<" "<<endl;ai.show_jishuyuan();cout<<" "<&l

29、t;endl;cout<<"*"<<endl;cout<<" 經理 "<<endl;cout<<" "<<endl;cout<<" 職工號姓名性別年齡工資"<<endl;for(i=0;i<n;i+) cout<<" "<<endl;.專業(yè) .專注.bi.show_jingli();cout<<" "<<endl;cout<

30、;<"*"<<endl;cout<<" 銷售經理 "<<endl;cout<<" "<<endl;cout<<" 職工號姓名性別年齡工資"<<endl;for(i=0;i<n;i+) cout<<" "<<endl;di.show_xiaoshoujingli();cout<<" "<<endl;cout<<"*

31、"<<endl;cout<<" 銷售員 "<<endl;cout<<" "<<endl;cout<<" 職工號 姓名性別年齡工資 所屬部門經理編號 "<<endl;for(i=0;i<n*2;i+).專業(yè) .專注. cout<<" "<<endl;ci.show_xiaoshouyuan2();cout<<" "<<endl;cout<<

32、"*"<<endl;disp(); ;break;case 4: int i;outfile<<"職工基本情況一覽表如下"<<endl;outfile<<"技術員 "<<endl;outfile<<" "<<endl;outfile<<"職工號姓名性別年齡工資"<<endl;for(i=0;i<n;i+) outfile<<" "<<end

33、l;ai.show_jishuyuan4();outfile<<" "<<endl;.專業(yè) .專注.outfile<<"*"<<endl;outfile<<"經理 "<<endl;outfile<<" "<<endl;outfile<<"職工號姓名性別年齡工資"<<endl;for(i=0;i<n;i+) outfile<<" "<&

34、lt;endl;bi.show_jingli4();outfile<<" "<<endl;outfile<<"*"<<endl;outfile<<"銷售經理 "<<endl;outfile<<" "<<endl;outfile<<"職工號姓名性別年齡工資"<<endl;for(i=0;i<n;i+) outfile<<" "<<

35、endl;di.show_xiaoshoujingli4();.專業(yè) .專注.outfile<<""<<endl;outfile<<"*"<<endl;outfile<<"銷售員 "<<endl;outfile<<" "<<endl;outfile<<" 職工號 姓名性別年齡工資 所屬部門經理編號 "<<endl;for(i=0;i<n*2;i+) outfile<

36、<" "<<endl;ci.show_xiaoshouyuan4();outfile<<""<<endl;outfile<<"*"<<endl;outfile.close();disp();break;case 5: exit(0); ;.專業(yè) .專注.break;default:cout<<"選擇錯誤 ,請重新選擇 !"<<endl;disp();break;return 0;.專業(yè) .專注.四、運行結果 小型公司工資管理系

37、統(tǒng) 請選擇您所需要的操作 數(shù)據(jù)輸入 : 1, 并按回車鍵 數(shù)據(jù)統(tǒng)計 : 2, 并按回車鍵 數(shù)據(jù)打印 : 3, 并按回車鍵 數(shù)據(jù)備份 : 4, 并按回車鍵 退出系統(tǒng) : 5, 并按回車鍵請選擇一個操作:1技術員編號 :101其姓名 :zhang1性別 (m/w):w年齡 :27工作時間 :56.專業(yè) .專注.技術員編號 :102其姓名 :wang1性別 (m/w):m年齡 :27工作時間 :58*經理的編號 :201其姓名 :wang2其性別 (m/w):w年齡 :34經理的編號 :202其姓名 :36.專業(yè) .專注.其性別 (m/w):m年齡 :36*銷售員的編號 :301其姓名 :zhang3性別 (m/w):m年齡 :28銷售額 :50000所屬銷售經理的編號:401銷售員的編號 :302其姓名 :wang3.專業(yè) .專注.性別 (m/w):w年齡 :32銷售額 :54000所屬銷售經理的編號:401銷售員的編號 :303其姓名 :wan1性別 (m/w):w年齡 :35銷售額 :60000所屬銷售經理的編號:402銷售員的編號 :304.專業(yè) .專注.其姓名 :wan2性別 (m/w):m年齡 :26銷售額 :80000所屬銷售經理的編號:402*銷售經理的編號:401其姓名 :sun性別 (m/w):w年齡 :36銷售經理的編號:402其姓名 :liu.專

溫馨提示

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

最新文檔

評論

0/150

提交評論