版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
1、. 程序設(shè)計(jì)實(shí)習(xí)報(bào)告小型公司工資管理系統(tǒng)的設(shè)計(jì)專業(yè)班級:電子信息工程目錄一、 實(shí)習(xí)內(nèi)容1二、 設(shè)計(jì)思路2三、 程序清單3四、 運(yùn)行結(jié)果4五、 程序使用說明5六、 總結(jié)及心得體會6;程序設(shè)計(jì)實(shí)習(xí)報(bào)告一、實(shí)習(xí)內(nèi)容本次實(shí)習(xí)的內(nèi)容是設(shè)計(jì)一個小型公司的工資管理系統(tǒng),通過這個系統(tǒng)實(shí)現(xiàn)對經(jīng)理、技術(shù)員、銷售員及銷售經(jīng)理等公司成員的職工號、姓名、年齡、月工資等信息的數(shù)據(jù)輸入、數(shù)據(jù)處理、數(shù)據(jù)的輸出顯示、數(shù)據(jù)的備份等功能。本次實(shí)習(xí)主要是針對較難綜合題目進(jìn)行分析、編程、調(diào)試和運(yùn)行,這利于我們進(jìn)一步掌握面向過程和面向?qū)ο蟪绦虻幕痉椒ê途幊碳记?,鞏固所學(xué)理論知識,使理論與實(shí)踐相結(jié)合,提高分析問題解決問題的能力。本次實(shí)習(xí)
2、的題目及要求如下:1.題目:小型公司工資管理系統(tǒng)的設(shè)計(jì)2.設(shè)計(jì)說明與基本要求:(1 )公司主要有4類人員:經(jīng)理、技術(shù)員、銷售員、銷售經(jīng)理。要求存儲這些人的職工號、姓名、性別、年齡、月工資等信息;(2) 工資的計(jì)算方法: 經(jīng)理:固定月薪為8000元;技術(shù)員:工作時間×工資(100元/小時);銷售員:銷售額×4%提成;銷售經(jīng)理:底薪(5000元)+下屬銷售員銷售額總額×0.5%;(3) 員工基本數(shù)據(jù)的輸入:要求每類人員不能少于4人,其中銷售員需要8名,每名銷售經(jīng)理手下有名銷售員。(4) 各類的數(shù)據(jù)成員訪問權(quán)限設(shè)置為:protected3.實(shí)現(xiàn)的基本功能:(1 )菜單選
3、擇功能; (2)數(shù)據(jù)的輸入;(3)數(shù)據(jù)的統(tǒng)計(jì); (4)數(shù)據(jù)的輸出,顯示;(5)數(shù)據(jù)的備份; (6)退出系統(tǒng)。 二、設(shè)計(jì)思路1.類的層次結(jié)構(gòu)2.設(shè)計(jì)思路首先要總體設(shè)計(jì),要有一個菜單,用于選擇各項(xiàng)功能,用來進(jìn)行數(shù)據(jù)的錄入,數(shù)據(jù)的統(tǒng)計(jì),數(shù)據(jù)的打印,數(shù)據(jù)的備份,進(jìn)入多級菜單,退出系統(tǒng)等功能。這就要充分利用了類的繼承與派生的知識,先定義一個基類base,由基類共有派生出技術(shù)員類 Tec,銷售員類Sel,經(jīng)理類Man,又由經(jīng)理類公有派生出銷售經(jīng)理類Sma。把基類定義成虛基類,通過基類去寫的派生類就可以調(diào)用基類的公有成員。程序中宜使用全局變量,便于修改,簡便清晰。定義完類后,定義各函數(shù),因?yàn)楦鞴δ艿膶?shí)現(xiàn)需要
4、定義與其功能相適應(yīng)的函數(shù),所以定義了數(shù)據(jù)輸入函數(shù)ph1( ),數(shù)據(jù)打印函數(shù)ph3( ),數(shù)據(jù)統(tǒng)計(jì)函數(shù)ph2( ),數(shù)據(jù)備份函數(shù)save( ),進(jìn)入多級菜單進(jìn)行統(tǒng)計(jì)函數(shù)ph4( )等。將主函數(shù)放在最后來實(shí)現(xiàn)整個程序的運(yùn)行,運(yùn)用switch語句選擇系統(tǒng)進(jìn)行的工作,在主菜單中進(jìn)行調(diào)用各函數(shù),從而實(shí)現(xiàn)各功能。程序中要求銷售經(jīng)理工資排序則采用的冒泡排序法實(shí)現(xiàn)。 三、程序清單# include <iostream># include <fstream># include <iomanip># include <string>using namespace s
5、td;fstream outfile;int m,i,t,x;int salary4=0,0,0,0;int s4=0,0,0,0;void menu() /定義主菜單函數(shù)cout<<"小型公司工資管理系統(tǒng)"<<endl; cout<<""<<endl; cout<<" 請選擇您所需的操作 "<<endl; cout<<" 數(shù)據(jù)輸入:1,并按回車鍵 "<<endl; cout<<" 數(shù)據(jù)統(tǒng)計(jì):2,并
6、按回車鍵 "<<endl; cout<<" 數(shù)據(jù)打印:3,并按回車鍵 "<<endl; cout<<" 數(shù)據(jù)備份:4,并按回車鍵 "<<endl; cout<<" 退出系統(tǒng):5,并按回車鍵 "<<endl; cout<<" 多級菜單:6,并按回車鍵 "<<endl; cout<<""<<endl; cout<<"請選擇一個操作: &q
7、uot;void menus() /定義多級菜單函數(shù)cout<<"小型公司工資管理系統(tǒng)"<<endl; cout<<""<<endl; cout<<" 請選擇您所需的操作 "<<endl; cout<<" 技術(shù)員基本情況 :1,并按回車鍵"<<endl; cout<<" 經(jīng)理基本情況 :2,并按回車鍵"<<endl; cout<<" 銷售經(jīng)理基本情況 :3
8、,并按回車鍵"<<endl; cout<<" 銷售員基本情況 :4,并按回車鍵"<<endl; cout<<" 返回上一級 :5,并按回車鍵"<<endl; cout<<""<<endl; cout<<"請選擇一個操作: "void heng() /定義heng函數(shù)cout<<"" <<endl;void form() /定義form函數(shù)cout<<&qu
9、ot;"<<endl; cout<<" 職工號 姓名 性別 年齡 工資 "<<endl; void forms() /定義forms函數(shù)outfile<<""<<endl;outfile<<" 職工號 姓名 性別 年齡 工資 "<<endl; void head() /定義head函數(shù) cout<<""<<endl; cout<<" 職工號 姓名 性別 年齡 工資 "
10、<<endl;void end() /定義end函數(shù) cout<<""<<endl;class Base /定義基類protected:int a,b,n;string c;char d;class Tec:protected Base /技術(shù)員類public:void print1 ()cout<<"技術(shù)員的編號: "cin>>a;cout<<"其姓名: "cin>>c;cout<<"性別(m/w):"cin>&
11、gt;d;cout<<"年齡: "cin>>n;cout<<"工作時間: "cin>>b; void out1()cout<<""<<endl;cout<<""<<setw(8)<<a<<""<<setw(6)<<c<<""<<setw(8)<<d<<""<&l
12、t;setw(8)<<n<<""<<setw(12)<<int(b*100)<<""<<endl;int a1()return a;int b1()return b;string c1()return c;char d1()return d;int n1()return n;Tec,tec4;class Man:protected Base /經(jīng)理類public:void out2()cout<<""<<endl;cout<<&
13、quot;"<<setw(8)<<a<<""<<setw(6)<<c<<""<<setw(8)<<d<<""<<setw(8)<<b<<""<<setw(12)<<"8000"<<""<<endl;int a2()return a;int b2()return b;string
14、 c2()return c;char d2()return d;int n2()return n;void print2 ()cout<<"經(jīng)理的編號: "cin>>a;cout<<"其姓名: "cin>>c;cout<<"性別(m/w):"cin>>d;cout<<"年齡: "cin>>b;Man,man4;class Sel:protected Base /銷售員類public:void print3 ()cout&
15、lt;<"銷售員的編號: "cin>>a;cout<<"其姓名: "cin>>c;cout<<"性別(m/w):"cin>>d;cout<<"年齡: "cin>>b;cout<<"銷售額: "cin>>n;cout<<"所屬銷售經(jīng)理的編號: "cin>>f;int printsnum() return f;int printmoney()r
16、eturn n;void out() cout<<""<<endl;cout<<""<<setw(9)<<a<<" "<<setw(9)<<c<<" "<<setw(9)<<n<<" "<<endl;void out3()cout<<""<<endl;cout<<""
17、<<setw(8)<<a<<""<<setw(6)<<c<<""<<setw(8)<<d<<""<<setw(8)<<b<<""<<setw(10)<<int(n*0.04)<<""<<setw(18)<<f<<""<<endl;int a3()ret
18、urn a;int b3()return b;string c3()return c;char d3()return d;int n3()return n;int f3()return f;private: int f;Sel,sel8;class Sma:protected Man /銷售經(jīng)理類public:void print4 ()cout<<"銷售經(jīng)理的編號: "cin>>a;cout<<"其姓名: "cin>>c;cout<<"性別(m/w):"cin>>
19、;d;cout<<"年齡: "cin>>b;int printnum()return a;string printname()return c;int a4()return a;int b4()return b;string c4()return c;char d4()return d;int n4()return n;void mout()cout<<""<<endl;cout<<""<<setw(8)<<a<<""&
20、lt;<setw(6)<<c<<""<<setw(8)<<d<<""<<setw(8)<<b<<""<<setw(12)<<int(5000+0.005*si)<<""<<endl;Sma sma4;void ph1() /定義數(shù)據(jù)輸入函數(shù) for(i=0;i<4;i+)teci.print1();heng(); for(i=0;i<4;i+)mani.p
21、rint2();heng(); for(i=0;i<8;i+)seli.print3();heng(); for(i=0;i<4;i+)smai.print4();heng();menu();void ph2() /定義數(shù)據(jù)統(tǒng)計(jì)函數(shù)int salary4=0,0,0,0;int s4=0,0,0,0;for(int j=0;j<=3;j+)cout<<"n職工號為"<<smaj.printnum()<<"銷售經(jīng)理"<<smaj.printname()<<"下屬銷售員的
22、業(yè)績?yōu)?"<<endl;cout<<'n'<<endl;cout<<""<<endl;cout<<" 職工號 姓名 銷售額 "<<endl;for(i=0;i<8;i+)if(seli.printsnum()=smaj.printnum()seli.out();sj+=seli.printmoney();salaryj=sj;cout<<""<<endl;cout<<"&qu
23、ot;<<" 銷售額總計(jì):"<<""<<setw(24)<<sj<<""<<endl;cout<<""<<endl;cout<<"n銷售經(jīng)理按工資排序?yàn)? "<<'n'<<endl;form();for(i=0;i<3;i+) for(j=0;j<3-i;j+)if(sj<sj+1)m=sj;sj=sj+1;sj+1=m;for(i
24、=0;i<4;i+) for(j=0;j<4;j+) if(salaryj=si) smaj.mout();break; cout<<""<<endl; menu ();void ph3 () /定義數(shù)據(jù)打印函數(shù)cout<<" 請等待."<<endl;cout<<"職工基本情況一覽表如下"<<endl;for(;) /死循環(huán)menus();cin>>m;if(m=1)cout<<"技術(shù)員"<<en
25、dl;form();for(int i=0;i<4;i+)teci.out1();cout<<""<<endl;heng();continue;else if(m=2)cout<<"經(jīng)理"<<endl;form();for(i=0;i<4;i+)mani.out2();cout<<""<<endl;heng();continue;else if(m=3)cout<<"銷售經(jīng)理"<<endl;form();fo
26、r(i=0;i<2;i+) for(int j=0;j<4;j+) if(salaryj=si) smaj.mout();break;cout<<""<<endl; heng();continue;else if (m=4)cout<<"銷售員"<<endl;cout<<""<<endl;cout<<" 職工號 姓名 性別 年齡 工資 所屬部門經(jīng)理編號 "<<endl;for(int k=0;k<=7;
27、k+)selk.out3();cout<<""<<endl;heng();continue;else if(m=5)break;else cout<<"你的選擇有誤,請重新選擇。:"<<endl;void ph4 () /定義進(jìn)入多級菜單,數(shù)據(jù)統(tǒng)計(jì)函數(shù) cout<<"職工基本情況一覽表如下:"<<endl; cout<<"技術(shù)員"<<endl; head(); for(i=0;i<4;i+) teci.out1()
28、; end(); cout<<"-"<<endl; cout<<"經(jīng)理"<<endl; head(); for(i=0;i<4;i+) mani.out2(); end(); cout<<"-"<<endl; cout<<"銷售經(jīng)理"<<endl; head(); for(i=0;i<4;i+) smai.mout(); end(); cout<<"-"<<endl
29、; cout<<"銷售員"<<endl; cout<<""<<endl; cout<<" 職工號 姓名 性別 年齡 工資 所屬部門經(jīng)理編號 "<<endl; for(i=0;i<8;i+) seli.out3(); cout<<""<<endl; cout<<"-"<<endl;menu();void save() /定義數(shù)據(jù)備份函數(shù)cout<<"數(shù)
30、據(jù)備份中,請稍等."<<endl;outfile.open("D:save.txt",ios:trunc|ios:out);outfile<<"技術(shù)員"<<endl;forms();for(i=0;i<4;i+)outfile<<""<<endl; outfile<<""<<setw(8)<<teci.a1()<<""<<setw(6)<<teci.
31、c1()<<""<<setw(8)<<teci.d1()<<""<<setw(8)<<teci.n1()<<""<<setw(12)<<int(teci.b1()*100)<<""<<endl;outfile<<""<<endl;outfile<<"" <<endl;outfile<<&
32、quot;經(jīng)理"<<endl;forms();for(i=0;i<4;i+)outfile<<""<<endl;outfile<<""<<setw(8)<<mani.a2()<<""<<setw(6)<<mani.c2()<<""<<setw(8)<<mani.d2()<<""<<setw(8)<<ma
33、ni.b2()<<""<<setw(12)<<"8000"<<""<<endl;outfile<<""<<endl;outfile<<"" <<endl;outfile<<"銷售經(jīng)理"<<endl;forms();for(i=0;i<4;i+)outfile<<""<<endl;outfile&l
34、t;<""<<setw(8)<<smai.a4()<<""<<setw(6)<<smai.c4()<<""<<setw(8)<<smai.d4()<<""<<setw(8)<<smai.b4()<<""<<setw(12)<<int(5000+0.005*salaryi)<<""<<
35、;endl;outfile<<""<<endl;outfile<<"" <<endl;outfile<<"銷售員"<<endl;outfile<<""<<endl;outfile<<" 職工號 姓名 性別 年齡 工資 所屬部門經(jīng)理編號 "<<endl;for(i=0;i<8;i+)outfile<<""<<endl;outfil
36、e<<""<<setw(8)<<seli.a3()<<""<<setw(6)<<seli.c3()<<""<<setw(8)<<seli.d3()<<""<<setw(8)<<seli.b3()<<""<<setw(10)<<int(seli.n3()*0.04)<<""<<
37、setw(18)<<seli.f3()<<""<<endl;outfile<<""<<endl;outfile<<"" <<endl;outfile.close();cout<<"備份完成!"<<endl;int main() /主函數(shù)menu();for(i=1;i<=10;i+)cin>>x;switch (x)case 1:ph1();break;case 2: ph2();break
38、;case 3:ph4();break;case 4:save();menu();break;case 6:ph3();menu();break;if(x=5)char t; cout<<"您確定要退出嗎?退出:請按 Y,否:請按N"<<endl;cout<<"請選擇:"cin>>t;for(;)if(t!='n'&&t!='N'&&t!='y'&&t!='Y') cout<<"您的選擇有誤,請重新選擇(Y/N):"else break;cin>>t;if(t='n'|t='N')menu();else break;return 0;四、運(yùn)行結(jié)果五、程序的使用說明1.菜單說明 :(1)數(shù)據(jù)輸入指通過鍵盤輸入經(jīng)理、技術(shù)員、銷售員及銷售經(jīng)理等公司成員的職
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 二零二五年度儲能設(shè)施供電接入合同3篇
- 二零二五年度充值卡充值業(yè)務(wù)合作協(xié)議4篇
- 二零二五年度家電產(chǎn)品智能升級改造采購協(xié)議3篇
- 二零二五年度智能廚衛(wèi)一體化櫥浴柜研發(fā)生產(chǎn)供貨合同3篇
- 2025年度個人二手挖掘機(jī)買賣合同國際市場拓展合同范本
- 2025年度城市地下綜合管廊建設(shè)投資合同書4篇
- 人工智能時代勞動市場分析-深度研究
- 2025年度農(nóng)藥行業(yè)供應(yīng)鏈金融合作協(xié)議4篇
- 智能物流系統(tǒng)設(shè)計(jì)-第1篇-深度研究
- 2025版企業(yè)間商業(yè)保理合同附應(yīng)收賬款抵押示范4篇
- 2024人教新目標(biāo)(Go for it)八年級英語下冊【第1-10單元】全冊 知識點(diǎn)總結(jié)
- 垃圾車駕駛員聘用合同
- 2024年大宗貿(mào)易合作共贏協(xié)議書模板
- 新聞記者證600道考試題-附標(biāo)準(zhǔn)答案
- 變壓器搬遷施工方案
- 單位轉(zhuǎn)賬個人合同模板
- 八年級語文下冊 成語故事 第十五課 諱疾忌醫(yī) 第六課時 口語交際教案 新教版(漢語)
- 中考語文二輪復(fù)習(xí):記敘文閱讀物象的作用(含練習(xí)題及答案)
- 2024年1月高考適應(yīng)性測試“九省聯(lián)考”數(shù)學(xué) 試題(學(xué)生版+解析版)
- (正式版)JBT 11270-2024 立體倉庫組合式鋼結(jié)構(gòu)貨架技術(shù)規(guī)范
- EPC項(xiàng)目采購階段質(zhì)量保證措施
評論
0/150
提交評論