




版權(quán)說(shuō)明:本文檔由用戶(hù)提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、. 程序設(shè)計(jì)實(shí)習(xí)報(bào)告小型公司工資管理系統(tǒng)的設(shè)計(jì)專(zhuān)業(yè)班級(jí):電子信息工程目錄一、 實(shí)習(xí)內(nèi)容1二、 設(shè)計(jì)思路2三、 程序清單3四、 運(yùn)行結(jié)果4五、 程序使用說(shuō)明5六、 總結(jié)及心得體會(huì)6;程序設(shè)計(jì)實(shí)習(xí)報(bào)告一、實(shí)習(xí)內(nèi)容本次實(shí)習(xí)的內(nèi)容是設(shè)計(jì)一個(gè)小型公司的工資管理系統(tǒng),通過(guò)這個(gè)系統(tǒng)實(shí)現(xiàn)對(duì)經(jīng)理、技術(shù)員、銷(xiāo)售員及銷(xiāo)售經(jīng)理等公司成員的職工號(hào)、姓名、年齡、月工資等信息的數(shù)據(jù)輸入、數(shù)據(jù)處理、數(shù)據(jù)的輸出顯示、數(shù)據(jù)的備份等功能。本次實(shí)習(xí)主要是針對(duì)較難綜合題目進(jìn)行分析、編程、調(diào)試和運(yùn)行,這利于我們進(jìn)一步掌握面向過(guò)程和面向?qū)ο蟪绦虻幕痉椒ê途幊碳记?,鞏固所學(xué)理論知識(shí),使理論與實(shí)踐相結(jié)合,提高分析問(wèn)題解決問(wèn)題的能力。本次實(shí)習(xí)
2、的題目及要求如下:1.題目:小型公司工資管理系統(tǒng)的設(shè)計(jì)2.設(shè)計(jì)說(shuō)明與基本要求:(1 )公司主要有4類(lèi)人員:經(jīng)理、技術(shù)員、銷(xiāo)售員、銷(xiāo)售經(jīng)理。要求存儲(chǔ)這些人的職工號(hào)、姓名、性別、年齡、月工資等信息;(2) 工資的計(jì)算方法: 經(jīng)理:固定月薪為8000元;技術(shù)員:工作時(shí)間×工資(100元/小時(shí));銷(xiāo)售員:銷(xiāo)售額×4%提成;銷(xiāo)售經(jīng)理:底薪(5000元)+下屬銷(xiāo)售員銷(xiāo)售額總額×0.5%;(3) 員工基本數(shù)據(jù)的輸入:要求每類(lèi)人員不能少于4人,其中銷(xiāo)售員需要8名,每名銷(xiāo)售經(jīng)理手下有名銷(xiāo)售員。(4) 各類(lèi)的數(shù)據(jù)成員訪問(wèn)權(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.類(lèi)的層次結(jié)構(gòu)2.設(shè)計(jì)思路首先要總體設(shè)計(jì),要有一個(gè)菜單,用于選擇各項(xiàng)功能,用來(lái)進(jìn)行數(shù)據(jù)的錄入,數(shù)據(jù)的統(tǒng)計(jì),數(shù)據(jù)的打印,數(shù)據(jù)的備份,進(jìn)入多級(jí)菜單,退出系統(tǒng)等功能。這就要充分利用了類(lèi)的繼承與派生的知識(shí),先定義一個(gè)基類(lèi)base,由基類(lèi)共有派生出技術(shù)員類(lèi) Tec,銷(xiāo)售員類(lèi)Sel,經(jīng)理類(lèi)Man,又由經(jīng)理類(lèi)公有派生出銷(xiāo)售經(jīng)理類(lèi)Sma。把基類(lèi)定義成虛基類(lèi),通過(guò)基類(lèi)去寫(xiě)的派生類(lèi)就可以調(diào)用基類(lèi)的公有成員。程序中宜使用全局變量,便于修改,簡(jiǎn)便清晰。定義完類(lèi)后,定義各函數(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í)菜單進(jìn)行統(tǒng)計(jì)函數(shù)ph4( )等。將主函數(shù)放在最后來(lái)實(shí)現(xiàn)整個(gè)程序的運(yùn)行,運(yùn)用switch語(yǔ)句選擇系統(tǒng)進(jìn)行的工作,在主菜單中進(jìn)行調(diào)用各函數(shù),從而實(shí)現(xiàn)各功能。程序中要求銷(xiāo)售經(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<<" 請(qǐng)選擇您所需的操作 "<<endl; cout<<" 數(shù)據(jù)輸入:1,并按回車(chē)鍵 "<<endl; cout<<" 數(shù)據(jù)統(tǒng)計(jì):2,并
6、按回車(chē)鍵 "<<endl; cout<<" 數(shù)據(jù)打印:3,并按回車(chē)鍵 "<<endl; cout<<" 數(shù)據(jù)備份:4,并按回車(chē)鍵 "<<endl; cout<<" 退出系統(tǒng):5,并按回車(chē)鍵 "<<endl; cout<<" 多級(jí)菜單:6,并按回車(chē)鍵 "<<endl; cout<<""<<endl; cout<<"請(qǐng)選擇一個(gè)操作: &q
7、uot;void menus() /定義多級(jí)菜單函數(shù)cout<<"小型公司工資管理系統(tǒng)"<<endl; cout<<""<<endl; cout<<" 請(qǐng)選擇您所需的操作 "<<endl; cout<<" 技術(shù)員基本情況 :1,并按回車(chē)鍵"<<endl; cout<<" 經(jīng)理基本情況 :2,并按回車(chē)鍵"<<endl; cout<<" 銷(xiāo)售經(jīng)理基本情況 :3
8、,并按回車(chē)鍵"<<endl; cout<<" 銷(xiāo)售員基本情況 :4,并按回車(chē)鍵"<<endl; cout<<" 返回上一級(jí) :5,并按回車(chē)鍵"<<endl; cout<<""<<endl; cout<<"請(qǐng)選擇一個(gè)操作: "void heng() /定義heng函數(shù)cout<<"" <<endl;void form() /定義form函數(shù)cout<<&qu
9、ot;"<<endl; cout<<" 職工號(hào) 姓名 性別 年齡 工資 "<<endl; void forms() /定義forms函數(shù)outfile<<""<<endl;outfile<<" 職工號(hào) 姓名 性別 年齡 工資 "<<endl; void head() /定義head函數(shù) cout<<""<<endl; cout<<" 職工號(hào) 姓名 性別 年齡 工資 "
10、<<endl;void end() /定義end函數(shù) cout<<""<<endl;class Base /定義基類(lèi)protected:int a,b,n;string c;char d;class Tec:protected Base /技術(shù)員類(lèi)public:void print1 ()cout<<"技術(shù)員的編號(hào): "cin>>a;cout<<"其姓名: "cin>>c;cout<<"性別(m/w):"cin>&
11、gt;d;cout<<"年齡: "cin>>n;cout<<"工作時(shí)間: "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)理類(lèi)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)理的編號(hào): "cin>>a;cout<<"其姓名: "cin>>c;cout<<"性別(m/w):"cin>>d;cout<<"年齡: "cin>>b;Man,man4;class Sel:protected Base /銷(xiāo)售員類(lèi)public:void print3 ()cout&
15、lt;<"銷(xiāo)售員的編號(hào): "cin>>a;cout<<"其姓名: "cin>>c;cout<<"性別(m/w):"cin>>d;cout<<"年齡: "cin>>b;cout<<"銷(xiāo)售額: "cin>>n;cout<<"所屬銷(xiāo)售經(jīng)理的編號(hào): "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 /銷(xiāo)售經(jīng)理類(lèi)public:void print4 ()cout<<"銷(xiāo)售經(jīng)理的編號(hào): "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職工號(hào)為"<<smaj.printnum()<<"銷(xiāo)售經(jīng)理"<<smaj.printname()<<"下屬銷(xiāo)售員的
22、業(yè)績(jī)?yōu)?"<<endl;cout<<'n'<<endl;cout<<""<<endl;cout<<" 職工號(hào) 姓名 銷(xiāo)售額 "<<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;<<" 銷(xiāo)售額總計(jì):"<<""<<setw(24)<<sj<<""<<endl;cout<<""<<endl;cout<<"n銷(xiāo)售經(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<<" 請(qǐng)等待."<<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<<"銷(xiāo)售經(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<<"銷(xiāo)售員"<<endl;cout<<""<<endl;cout<<" 職工號(hào) 姓名 性別 年齡 工資 所屬部門(mén)經(jīng)理編號(hào) "<<endl;for(int k=0;k<=7;
27、k+)selk.out3();cout<<""<<endl;heng();continue;else if(m=5)break;else cout<<"你的選擇有誤,請(qǐng)重新選擇。:"<<endl;void ph4 () /定義進(jìn)入多級(jí)菜單,數(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<<"銷(xiāo)售經(jīng)理"<<endl; head(); for(i=0;i<4;i+) smai.mout(); end(); cout<<"-"<<endl
29、; cout<<"銷(xiāo)售員"<<endl; cout<<""<<endl; cout<<" 職工號(hào) 姓名 性別 年齡 工資 所屬部門(mén)經(jīng)理編號(hào) "<<endl; for(i=0;i<8;i+) seli.out3(); cout<<""<<endl; cout<<"-"<<endl;menu();void save() /定義數(shù)據(jù)備份函數(shù)cout<<"數(shù)
30、據(jù)備份中,請(qǐng)稍等."<<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<<"銷(xiāo)售經(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<<"銷(xiāo)售員"<<endl;outfile<<""<<endl;outfile<<" 職工號(hào) 姓名 性別 年齡 工資 所屬部門(mén)經(jīng)理編號(hào) "<<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<<"您確定要退出嗎?退出:請(qǐng)按 Y,否:請(qǐng)按N"<<endl;cout<<"請(qǐng)選擇:"cin>>t;for(;)if(t!='n'&&t!='N'&&t!='y'&&t!='Y') cout<<"您的選擇有誤,請(qǐng)重新選擇(Y/N):"else break;cin>>t;if(t='n'|t='N')menu();else break;return 0;四、運(yùn)行結(jié)果五、程序的使用說(shuō)明1.菜單說(shuō)明 :(1)數(shù)據(jù)輸入指通過(guò)鍵盤(pán)輸入經(jīng)理、技術(shù)員、銷(xiāo)售員及銷(xiāo)售經(jīng)理等公司成員的職
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶(hù)所有。
- 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ì)用戶(hù)上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶(hù)上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶(hù)因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年中考《化學(xué)》押題超車(chē)卷(福建專(zhuān)用)
- 古詩(shī)詞誦讀《虞美人》經(jīng)典課件
- 兒童呼吸道感染應(yīng)對(duì)指南2025
- Brand KPIs for online betting:Caliente in Mexiko-英文培訓(xùn)課件2025.5
- AIGC生成式AI大模型醫(yī)療場(chǎng)景應(yīng)用可行性研究報(bào)告
- 小兒cpap試題及答案
- 河南省平頂山市魯山縣部分中學(xué)2024-2025學(xué)年八年級(jí)下學(xué)期5月月考語(yǔ)文試卷(含答案)
- 2025年安徽省高考生物試卷
- 2025橋梁混凝土結(jié)構(gòu)施工合同
- 2025石油購(gòu)銷(xiāo)合同范本模板
- 注冊(cè)安全工程師安全生產(chǎn)技術(shù)培訓(xùn)課件
- 電商倉(cāng)庫(kù)流程及診斷
- 施工場(chǎng)地平整施工方案
- 湘少版英語(yǔ)三至六年級(jí)單詞表(帶音標(biāo))
- SCB系列干式變壓器使用說(shuō)明書(shū)
- 202x檢察院工作總結(jié)匯報(bào)、述職報(bào)告PPT模板
- YYT 1182-2020 核酸擴(kuò)增檢測(cè)用試劑(盒)
- GB∕T 33212-2016 錘上鋼質(zhì)自由鍛件 通用技術(shù)條件
- 高效液相色譜法分析(三聚氰胺)原始記錄1
- 全國(guó)公共英語(yǔ)等級(jí)考試三教材-Monolog-and-passage原文及翻譯-一字一句輸入的
- 匯川伺服追剪控制指導(dǎo)說(shuō)明完整版
評(píng)論
0/150
提交評(píng)論