小型公司工資管理系統(tǒng)C++課程設(shè)計(jì)報(bào)告_第1頁(yè)
小型公司工資管理系統(tǒng)C++課程設(shè)計(jì)報(bào)告_第2頁(yè)
小型公司工資管理系統(tǒng)C++課程設(shè)計(jì)報(bào)告_第3頁(yè)
小型公司工資管理系統(tǒng)C++課程設(shè)計(jì)報(bào)告_第4頁(yè)
小型公司工資管理系統(tǒng)C++課程設(shè)計(jì)報(bào)告_第5頁(yè)
已閱讀5頁(yè),還剩32頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

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

文檔簡(jiǎn)介

1、c+程序設(shè)計(jì)課程設(shè)計(jì)報(bào)告課 題: 小型公司工資管理系統(tǒng)專業(yè)班級(jí): xxxxx 學(xué) 號(hào): xxxxxxxx 姓 名: xxxxx 評(píng)閱意見:評(píng)定成績(jī): 指導(dǎo)老師簽名: 2012 年 6 月 12 日指導(dǎo)教師: xxxxx 目錄目錄一、課程設(shè)計(jì)內(nèi)容31.1課程設(shè)計(jì)的目的31. 2設(shè)計(jì)題目及要求3二、設(shè)計(jì)思路4三、程序清單72. 1程序源代碼7四、運(yùn)行結(jié)果304.1程序運(yùn)行313. 2備份文本信息34五、程序使用說明36六、總結(jié)及心得體會(huì)36(要求:給出一級(jí)目錄,宋體加粗,四號(hào)字, 1.5倍行距)一:課程設(shè)計(jì)內(nèi)容1.1、課程設(shè)計(jì)的目的 此次課程設(shè)計(jì)的目的是以程序設(shè)計(jì)語(yǔ)言(c/c+)為基礎(chǔ),針對(duì)具有一

2、定難度的綜合性題目,進(jìn)行分析、編程、調(diào)試和運(yùn)行,進(jìn)一步掌握面向?qū)ο蠛兔嫦蜻^程程序設(shè)計(jì)的基本方法和編程技巧,鞏固所學(xué)理論知識(shí),使理論與實(shí)踐相結(jié)合,提高分析問題、解決問題的能力。通過設(shè)計(jì)一個(gè)簡(jiǎn)單的小型公司工資管理系統(tǒng),進(jìn)一步熟悉c+中類的概念、類的封裝、繼承和多態(tài)的實(shí)現(xiàn)方式。了解系統(tǒng)開發(fā)的需要分析,類層次設(shè)計(jì),模塊分析,編碼測(cè)試,模塊組裝與整體調(diào)試的全過程,逐步熟悉程序設(shè)計(jì)的方法,并養(yǎng)成良好的編程習(xí)慣。1.2、設(shè)計(jì)題目及要求(1) 題目:小型公司工資管理系統(tǒng) 設(shè)計(jì)(2) 設(shè)計(jì)題目及要求:1.公司主要有4類人員:經(jīng)理、技術(shù)員、銷售員、銷售經(jīng)理。要求存儲(chǔ)這些人的職工號(hào)、姓名、月工資、崗位、年齡、性別等

3、信息。其中(1)職工編號(hào)在輸入人員信息時(shí)生成,每輸入一個(gè)人員信息編號(hào)順序加1。(2)程序?qū)λ腥藛T有提升級(jí)別的功能。 (3)能夠按照不同身份進(jìn)行月薪的計(jì)算。 (4)能按姓名或者編號(hào)查找各類人員的信息。(5)能夠修改/刪除各類人員的信息。(6)能夠顯示所有人員的信息。2.工資的計(jì)算辦法:經(jīng)理:固定月薪為8000;技術(shù)員:工作時(shí)間小時(shí)工資(100元每小時(shí));銷售員:銷售額4%提成;銷售經(jīng)理:底薪(5000)所轄部門銷售額總額0.5%;3)類的層次結(jié)構(gòu)大體如下: 雇員類技術(shù)員類經(jīng)理類銷售員類銷售經(jīng)理類1.3 課程設(shè)計(jì)步驟與方法 1.需求分析:對(duì)用戶提出的問題提出解決的辦法和思路。 2.根據(jù)需求,設(shè)計(jì)

4、系統(tǒng)功能模塊,并設(shè)計(jì)相應(yīng)的類和界面。 3.根據(jù)基本思路,確定輸入和輸出,設(shè)計(jì)程序的算法。 4.確定用到的所有類的描述和定義,并設(shè)計(jì)測(cè)試程序來對(duì)類進(jìn)行測(cè)試。 6.在計(jì)算機(jī)上編譯程序,檢驗(yàn)程序的可運(yùn)行性。1.4 課程設(shè)計(jì)報(bào)告內(nèi)容 寫設(shè)計(jì)報(bào)告(要求正規(guī)打印,a4幅面),內(nèi)容包括:題目系統(tǒng)功能模塊結(jié)構(gòu)圖數(shù)據(jù)結(jié)構(gòu)設(shè)計(jì)及用法說明程序結(jié)構(gòu)(畫流程圖)各模塊的功能試驗(yàn)結(jié)果(包括輸入數(shù)據(jù)和輸出結(jié)果)體會(huì)參考文獻(xiàn)附錄:源程序清單二、設(shè)計(jì)思路1、整體考慮程序應(yīng)該實(shí)現(xiàn)的功能,有員工信息管理、職務(wù)管理、月薪計(jì)算、查找信息、顯示所有人員的信息和退出系統(tǒng)6個(gè)。2、首先定義一個(gè)employee的雇員基類,然后由此派生出man

5、ager、seller、tech三個(gè)分別為經(jīng)理類、銷售員類、技術(shù)員類;再由seller派生出銷售經(jīng)理類xmanager。每個(gè)類中的成員都是public型的,所有的繼承都是公有繼承,基類中定義有數(shù)據(jù)輸入和輸出函數(shù)。3、整個(gè)程序由主函數(shù)的一個(gè)for循環(huán)控制,根據(jù)輸入的操作選項(xiàng)通過一個(gè)switch語(yǔ)句判斷該進(jìn)行什么操作,每一個(gè)case后面對(duì)應(yīng)一個(gè)函數(shù),每個(gè)函數(shù)對(duì)應(yīng)一個(gè)操作,1對(duì)應(yīng)信息管理,2對(duì)應(yīng)職務(wù)管理,3對(duì)應(yīng)月薪計(jì)算,4對(duì)應(yīng)查找信息,5對(duì)應(yīng)顯示所有人員的信息,0對(duì)應(yīng)退出系統(tǒng)。4、case中調(diào)用了五個(gè)無參的函數(shù)allsave()exit();datamanagement() ;postmanamen

6、u() ;calculatesal() ;findmenu() ;alldisplay() ;五個(gè)函數(shù)均用了模板函數(shù)的實(shí)例化分別進(jìn)行輸入、職務(wù)管理、計(jì)算月薪、顯示全部信息。如輸入中的一個(gè):template void showmember(t & t , ti * ti )if(t.n next ) t.p - show() ;showmember()函數(shù)在各個(gè)類中都定義,并且同名,這樣能簡(jiǎn)化程序。5、在進(jìn)行信息輸入時(shí),在基類中定義了一個(gè)虛函數(shù),避免了值的副本,首先給出提示語(yǔ)句,首先選擇要輸入的職工類型,然后依次調(diào)用savefile(),首先創(chuàng)建類的對(duì)象指針,如seller * t ;ofstr

7、eam cout (s.txt),建立文件流,創(chuàng)建鏈表,將所輸入的數(shù)據(jù)都保存至文件,并且對(duì)備份文件進(jìn)行命名,同時(shí)確定存儲(chǔ)位置。以便之后的查找和刪除功能的實(shí)現(xiàn)。6、在進(jìn)行工資計(jì)算時(shí),每個(gè)類都定義了各自的calcusalary()函數(shù),依次計(jì)算出每一種職工的工資,由提示語(yǔ)句選擇是否輸出。7、職務(wù)管理功能的實(shí)現(xiàn),是通過編號(hào)來查找要提升職位的人員,選擇要升為哪一種職位,然后將多余的數(shù)據(jù)成員刪除,在提升后的成員中將工資重新進(jìn)行計(jì)算,予以賦值。8、查找時(shí),建立函數(shù)模板,參數(shù)為class t , class ti,需要在哪一個(gè)類中查找就將模板實(shí)例化為哪一個(gè)類,每一次查找時(shí),指針都是先指向文件的起始位置,然后

8、用for循環(huán)來控制,先要輸入編號(hào),如t.p != null & t.p - num != no;若當(dāng)前對(duì)象的編號(hào)與輸入的編號(hào)不相等,則指針移向下一個(gè)對(duì)象繼續(xù)查找,若相等則停止查找,并將所找到的信息全部輸出。9、考慮各種數(shù)據(jù)類型還有所需的c+內(nèi)的函數(shù),要引用這四個(gè)頭文件。用于數(shù)據(jù)保存至文件。 10、修改和刪除的功能都是按照編號(hào)、利用模板函數(shù)實(shí)例化來實(shí)現(xiàn)的,找到后由switch控制,1.姓名 2.性別 3.年齡 4.編號(hào) 5.工資,先選擇要修改的屬性,然后輸入新信息,將原有信息替換;刪除時(shí),首先在每一個(gè)類中由指針找到要?jiǎng)h除的職工,然后將這個(gè)對(duì)象的每一個(gè)數(shù)據(jù)成員用null覆蓋,即清零處理,該職工的信

9、息就被刪除了。11、整體構(gòu)思比較簡(jiǎn)單,基本能夠?qū)崿F(xiàn)各項(xiàng)功能源程序清單:#include#include#include#includeusing namespace std ;class employeepublic:employee * next ; char name50; int num; int age; char sex8; double salary;char post30;char * getname()return name ;int getnum()return num ;int getage()return age ;char * getsex()return sex ;d

10、ouble getsalary()return salary ;char * getpost()return post ;virtual void get()coutname;coutsex;coutage;coutnum;employee()salary = 0.0 ;virtual void show()couttnametsextagetnumtsalarytpostendl ;class tech:virtual public employeepublic:int hour ;tech * next ;void get()employee:get(); couthour ;double

11、 gethour()return hour ;double calcusalary() salary = 100 * hour ;return salary; ;class seller:virtual public employeepublic:seller *next ;double income ;void get()employee:get();coutincome ;double calcusalary()salary = income * 0.04 ;return salary ;double getincome() return income ; ;class manager:v

12、irtual public employeepublic:manager * next ;void calcusalary()salary = 8000.00 ;class sellerlistpublic :int n ;seller * head , *p ;sellerlist()n = 0 ;p = head = null ;void inputfile() ;void savefile() ; s ;template void addmember(tt & t , ti * ti )ti * p = t.head ;t.head = ti ;if(p = null) t.head -

13、 next = null ;t.head - next = p ;t.n + ;void sellerlist:inputfile()seller * t;char na50 ;ifstream cins (s.txt) ;while(cins na )t = new seller() ;t - next = null ;strcpy(t - name , na ) ;cins (t - post ) (t - sex) (t - num) (t - age) (t - salary) (t - income) ;addmember(s , t ) ;void sellerlist:savef

14、ile() seller * t ;ofstream cout (s.txt) ;for(t = s.head ; t != null ; t = t -next )cout name) post ) sex) num) age) salary) income) next ) salary += t - income * 0.005 ;return salary ;class techlistpublic :int n ;tech * head , * p ;techlist()n = 0 ;p = head = null ;void inputfile() ;void savefile()

15、; t ;template void showmember(t & t , ti * ti )if(t.n next ) t.p - show() ;void techlist:inputfile()char na50 ;tech * t ;ifstream cint (t.txt) ;while(cint na )t = new tech() ;t - next = null ;strcpy(t - name , na ) ;cint (t - post ) (t - sex) (t - num) (t - age) (t - salary) (t - hour) ;addmember(t

16、, t ) ;void techlist:savefile() tech * t ;ofstream cout (t.txt) ;for(t = t.head ; t != null ; t = t -next )cout name) post ) sex) num) age) salary) hour) na )t = new xmanager() ;t - next ;strcpy(t - name , na ) ;cinx (t - post ) (t - sex) (t - num) (t - age) (t - salary) ;addmember(x , t ) ;void xma

17、nagerlist:savefile() xmanager * t ;ofstream cout (x.txt) ;for(t = x.head ; t != null ; t = t -next )cout name) post ) sex) num) age) salary) na )t = new manager() ;t - next = null ;strcpy(t - name , na ) ;cinm (t - post ) (t - sex) (t - num) (t - age) (t - salary ) ;addmember(m , t ) ;void managerli

18、st:savefile() manager * t ;ofstream cout (m.txt) ;for(t = m.head ; t != null ; t = t -next )cout name) post ) sex) num) age) salary)endl ;void exit()coutt您已成功退出系統(tǒng)!endl;exit(0) ;int mainmenu() coutt_endl ;coutt 主菜單endl ;coutt_nnendl ;coutt 1. 員工信息管理endl;coutt 2. 職務(wù)管理endl;coutt 3. 月薪計(jì)算endl;coutt 4. 員工

19、信息查找endl;coutt 5. 顯示所有人員信息endl;coutt 0. 退出程序 endl;coutt_nnendl ; cout ;return 0;void adddatamenu() int sel ;tech * ti ;seller *si ;manager * mi ;xmanager * xi ;coutnnnnt*endl ;coutt 添加員工信息endl ;coutt*nendl ;coutt 1. 技術(shù)員endl;coutt 2. 銷售員endl;coutt 3. 銷售經(jīng)理endl;coutt 4. 總經(jīng)理endl;coutt 0. 返回endl;coutt_nn

20、endl ; cout ;while(cinsel & (sel 4 | sel 0 ) ) cout post, 技術(shù)員) ; ti - get() ;/ti - show() ;addmember(t , ti) ;break ;case 2 :si = new seller() ;strcpy(si - post , 銷售員) ;si - get() ;addmember(s , si ) ;break ;case 3 :xi = new xmanager() ;strcpy(xi - post , 銷售經(jīng)理) ;xi - get() ;addmember(x , xi) ;break

21、;case 4 :mi = new manager() ;strcpy(mi - post , 總經(jīng)理) ;mi - get() ;addmember(m , mi ) ;break ;default : break ;template void renewmember(t & t , ti * ti )int no , sel ;coutno ;if(findmember(t , ti , no ) = false )coutnt該員工不存在,操作失敗! endl ;return ;coutnnntn;coutt1.姓名t2.性別t3.年齡t4.編號(hào)t5.工資endl ;cout show(

22、) ;coutntn;coutsel ;if(sel 5 )coutnt對(duì)不起,您的輸入有誤,操作失敗 !endl ;return ;char na50 , s8 ;int a , nu ;double sal ;switch(sel )case 1: coutna ;strcpy(t.p - name , na ) ;coutnt修改成功 ! endl ;break ;case 2: couts ;strcpy(t.p - sex , s ) ;coutnt修改成功 ! endl ;break ;case 3: couta ;t.p - age = a ;coutnt修改成功 ! endl

23、;break ;case 4: coutnu ;t.p - num = nu ;coutnt修改成功 ! endl ;break ;case 5: coutsal ;t.p - salary = sal ;coutnt修改成功 ! endl ;break ;default :break ;void renewdata()int sel ;tech * t ;seller * s ;xmanager * x ;manager * m ;coutnnntn;coutt 修改員工信息endl ;couttn;coutt 1. 技術(shù)員endl;coutt 2. 銷售員endl;coutt 3. 銷售經(jīng)

24、理endl;coutt 4. 總經(jīng)理endl;coutt 0. 返回endl;couttn; cout ;while(cinsel & (sel 4 | sel 0 ) ) coutnt您的輸入有誤,請(qǐng)重新輸入: ;switch(sel )case 0 : return ;case 1 :renewmember(t , t ) ;break ;case 2 : renewmember(s , s ) ;break ;case 3 : renewmember(x , x ) ;break ;case 4 :renewmember(m , m ) ;break ;default : break ;

25、template bool deletemember(t & t , ti * ti , int no)if(findmember(t , ti , no ) = false )coutnt該員工不存在,操作失敗! num = no )delete(t.head ) ;t.head = null ;return true;ti * pi ;for(ti = t.head ; ti - next != null & ( (ti - next - num) != no) ; ti = ti - next ) ;pi = ti - next - next ;delete(ti - next ) ;t

26、i - next = pi ;return true ;void deletedata()int sel ;tech * t ;seller * s ;xmanager * x ;manager * m ;coutnnnt*endl ;coutt_nendl ;coutt 刪除員工信息endl ;coutt*nendl ;coutt 1. 技術(shù)員endl;coutt 2. 銷售員endl;coutt 3. 銷售經(jīng)理endl;coutt 4. 總經(jīng)理endl;coutt 0. 返回endl;coutt_nnendl ; cout ;while(cinsel & (sel 4 | sel 0 )

27、) coutnt您的輸入有誤,請(qǐng)重新輸入: ;coutendl ;int no ;switch(sel )case 0 : return ;case 1 :cout ;cinno ;if(deletemember(t ,t , no) coutnt刪除成功 !endl ;break ;case 2 : cout ;cinno ;if(deletemember(s , s , no)coutnt刪除成功 !endl ;break ;case 3 : cout ;cinno ;if(deletemember(x , x, no) ) coutnt刪除成功 !endl ;break ;case 4

28、:cout ;cinno ;if(deletemember(m , m , no) ) coutnt刪除成功 !endl ;break ;default : break ;void datamanagement() int sel ;while(1)coutnnnnt*endl ;coutt 員工信息管理endl ;coutt*nendl ;coutt 1. 添加信息endl;coutt 2. 修改信息endl;coutt 3. 刪除信息endl;coutt 0. 返回endl;coutt_nnendl ;cout ;while(cinsel & (sel 3 | sel 0 ) ) cout

29、nt您的輸入有誤,請(qǐng)重新輸入: ;switch(sel )case 0 : return ;case 1 : adddatamenu() ; break ;case 2 : renewdata() ; break ;case 3 : deletedata() ; break ;default : break ;template bool findmember(t & t , ti * ti , int no)for(t.p = t.head ; t.p != null & t.p - num != no ; t.p = t.p - next ) ;if(t.p != null ) return

30、 true ;else return false ;void all_init()t.head = null ;s.head = null ;m.head = null ;x.head = null ;t.inputfile() ;s.inputfile() ;m.inputfile() ;x.inputfile() ;void allsave()t.savefile() ;s.savefile() ;m.savefile() ;x.savefile() ;template void copymember(t *t , s *s )strcpy(t - name , s - name ) ;s

31、trcpy(t - sex , s - sex ) ;t - age = s - age ;t - num = s - num ;template int changepost(tt t , ti ti )int no , sel ;tech * tt ;seller * ss ;xmanager * xx ;manager * mm ;coutno ;if(findmember(t , ti , no ) = false )coutnt該員工不存在,操作失敗! endl ;return no ;coutnnnt*endl ;coutt 調(diào)換為: endl ;coutt*nendl ;cout

32、t 1. 技術(shù)員endl;coutt 2. 銷售員endl;coutt 3. 銷售經(jīng)理endl;coutt 4. 總經(jīng)理endl;coutt 0. 返回endl;coutt_nnendl ; cout ;while(cinsel & (sel 4 | sel 0 ) ) coutnt您的輸入有誤,請(qǐng)重新輸入: ;cout post ,技術(shù)員) ;tt - salary = 0.0 ;tt - hour = 0 ;copymember(tt, t.p ) ;/tt - show() ;addmember(t , tt ) ;/t.head-show() ;/deletemember(t, ti

33、, no ) ;break ;case 2 : ss = new seller() ;strcpy(ss - post ,銷售員) ;ss - salary = 0.0 ;ss - income = 0.0 ;copymember(ss, t.p ) ;/ss- show() ;addmember(s , ss ) ;/t.head-show() ;break ;case 3 : xx = new xmanager() ;strcpy(xx - post ,銷售經(jīng)理) ;xx - salary = 8000 ;xx - income = 0.0 ;copymember(xx, t.p ) ;/

34、ss- show() ;addmember(x , xx ) ;/t.head-show() ;break ;case 4 :mm = new manager() ;strcpy(mm - post ,總經(jīng)理) ;mm - salary = 8000 ;copymember(mm, t.p ) ;/ss- show() ;addmember(m , mm ) ;/t.head-show() ;break ;default : break ;return no ;void postmanamenu()int sel , no ;tech * t ;seller * s ;xmanager * x

35、 ;manager * m ;coutnnnt*endl ;coutt_nendl ;coutt 員工職位調(diào)換endl ;coutt_nnendl ;coutt 1. 技術(shù)員endl;coutt 2. 銷售員endl;coutt 3. 銷售經(jīng)理endl;coutt 4. 總經(jīng)理endl;coutt_nnendl ; cout ;while(cinsel & (sel 4 | sel 0) ) coutnt您的輸入有誤,請(qǐng)重新輸入: ;coutendl ;switch(sel )case 0 : return ;case 1 :t = new tech() ;no = changepost(t , t ) ;deletemember(t , t , no ) ;break ;case 2 : s = new seller() ;no = changepost(s , s ) ;deletemember(s , s , no ) ;break ;case 3 : x = new xmanager() ;no = changepost(x

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝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ù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 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)論