面向?qū)ο缶幊碳夹g(shù)課程設(shè)計(jì)報(bào)告某學(xué)校對員工的獎(jiǎng)金管理系統(tǒng)_第1頁
面向?qū)ο缶幊碳夹g(shù)課程設(shè)計(jì)報(bào)告某學(xué)校對員工的獎(jiǎng)金管理系統(tǒng)_第2頁
面向?qū)ο缶幊碳夹g(shù)課程設(shè)計(jì)報(bào)告某學(xué)校對員工的獎(jiǎng)金管理系統(tǒng)_第3頁
面向?qū)ο缶幊碳夹g(shù)課程設(shè)計(jì)報(bào)告某學(xué)校對員工的獎(jiǎng)金管理系統(tǒng)_第4頁
面向?qū)ο缶幊碳夹g(shù)課程設(shè)計(jì)報(bào)告某學(xué)校對員工的獎(jiǎng)金管理系統(tǒng)_第5頁
已閱讀5頁,還剩9頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

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

文檔簡介

1、面向?qū)ο缶幊碳夹g(shù)課程設(shè)計(jì)報(bào)告書目錄1 某學(xué)校對員工的獎(jiǎng)金管理系統(tǒng)11.1問題認(rèn)識與分析11.2 程序功能說明,程序結(jié)構(gòu)圖11.4代碼說明21.4.1開發(fā)環(huán)境21.4.2主要開發(fā)步驟21.5 操作說明61.6設(shè)計(jì)開發(fā)過程中,遇到的主要問題以及解決方法62 mfc計(jì)算器設(shè)計(jì)72.1問題認(rèn)識與分析72.2 程序功能說明,程序結(jié)構(gòu)圖72.4代碼說明72.4.1開發(fā)環(huán)境72.4.2主要開發(fā)步驟7參考文獻(xiàn)資料151 某學(xué)校對員工的獎(jiǎng)金管理系統(tǒng)1.1問題認(rèn)識與分析此控制臺程序,我們要對管理人員按其職務(wù)發(fā)固定的崗位獎(jiǎng),對專職教師按其職稱和月任課時(shí)數(shù)計(jì)發(fā)業(yè)績獎(jiǎng),對既有管理工作又兼授課的人員按崗位獎(jiǎng)加月任課時(shí)數(shù)乘

2、某系數(shù)之和為獎(jiǎng)金數(shù)。我們可以建立一個(gè)抽象類,具有員工的基本數(shù)據(jù)成員,計(jì)算月獎(jiǎng)金和顯示信息的成員函數(shù)。由于不同人員的獎(jiǎng)金計(jì)算方法不同,所以將這兩個(gè)成員函數(shù)聲明為虛函數(shù)。以抽象類為基類派生出三種不同人員類,有派生類對月獎(jiǎng)金和顯示信息函數(shù)進(jìn)行重載。主函數(shù)實(shí)現(xiàn)動態(tài)調(diào)用,計(jì)算個(gè)人員的月獎(jiǎng)金。1.2 程序功能說明,程序結(jié)構(gòu)圖管理人員兼教師類:獎(jiǎng)金=固定崗位獎(jiǎng)+上課時(shí)間*每小時(shí)獎(jiǎng)金+級別(15級)*某系數(shù);專職教師類:獎(jiǎng)金為上課時(shí)間*每小時(shí)獎(jiǎng)金數(shù)+級別(15級)*某系數(shù);校園管理人員類:獎(jiǎng)金發(fā)放固定崗位獎(jiǎng)+級別(15級)*某系數(shù);基本抽象類:employee無對象,派生其他類1.4代碼說明c+面向?qū)ο蟮木幾g

3、方法1.4.1開發(fā)環(huán)境microsoft visual c+ 6.01.4.2主要開發(fā)步驟employee.h#include<iostream>using namespace std;class employeeprotected:char name20;int individualempno;float accumpay;static int employeeno;public:employee();employee();virtual void pay()=0;void setname(char *names);char *getname();int getindividua

4、lempno();float getaccumpay();class teacher:virtual public employeeprotected:int grade;float hourlyrate;int workhours;public:teacher();void setgrade(int g);int getgrade();void setworkhours(int w);void pay();class technician:virtual public employeeprotected:float monthlypay;public:technician();void pa

5、y();class manager:public technician, public teacherprivate:float k;public:manager();void pay();int employee:employeeno=1000; employee:employee()individualempno=employeeno+;accumpay=0.0;employee:employee()void employee:setname(char *names)strcpy(name,names);char*employee:getname()return name;float em

6、ployee:getaccumpay()return accumpay;int employee:getindividualempno()return individualempno;teacher:teacher()hourlyrate=50;void teacher:setworkhours(int w)workhours=w;void teacher:setgrade(int g)grade=g;int teacher:getgrade()return grade;void teacher:pay() accumpay=(hourlyrate*workhours)*grade;techn

7、ician:technician()monthlypay=2000;void technician:pay() accumpay=monthlypay;manager:manager()k=0.6;hourlyrate=100;monthlypay=2000;void manager:pay() accumpay=(monthlypay+hourlyrate*workhours)*k;int main()teacher t1;technician n1;manager m1;char namestr20;employee * emp3=&t1,&n1,&m1;int i

8、,ww,g,w;for(i=0;i<3;i+)cout<<"請輸入下一個(gè)雇員的姓名"cin>>namestr;empi->setname(namestr);cout<<"請輸入老師上課次數(shù)和等級:"cin>>ww>>g;t1.setworkhours(ww);t1.setgrade(g);cout<<"請輸入管理上課次數(shù):" cin>>w;m1.setworkhours(w);for(i=0;i<3;i+)empi->pay()

9、;cout<<"老師:"<<t1.getname()<<",編號:"<<t1.getindividualempno()<<",等級:"<<t1.getgrade()<<",獎(jiǎng)金:"<<t1.getaccumpay()<<endl;cout<<"校工:"<<n1.getname()<<",編號:"<<n1.getindivi

10、dualempno()<<",獎(jiǎng)金:"<<n1.getaccumpay()<<endl;cout<<"經(jīng)理:"<<m1.getname()<<",編號:"<<m1.getindividualempno()<<",獎(jiǎng)金:"<<m1.getaccumpay()<<endl;return(0);1.5 操作說明1.6設(shè)計(jì)開發(fā)過程中,遇到的主要問題以及解決方法l c+語法學(xué)習(xí)存在缺陷,管理兼教師類的實(shí)現(xiàn)總

11、是亂碼(數(shù)字不正確); 2 mfc計(jì)算器設(shè)計(jì)2.1問題認(rèn)識與分析創(chuàng)建基于對話框的mfc(exe)應(yīng)用程序計(jì)算器;在對話框窗體上順序創(chuàng)建0到9十個(gè)數(shù)字按鈕,有計(jì)算的一些按鈕(+,-,*,/)實(shí)現(xiàn)簡易的計(jì)算。2.2 程序功能說明,程序結(jié)構(gòu)圖2.4.1開發(fā)環(huán)境microsoft visual c+ 6.0mfc(exe)2.4.2主要開發(fā)步驟在對話框窗體上順序創(chuàng)建0到9十個(gè)數(shù)字按鈕,并設(shè)置其標(biāo)識符分別為idc_0到idc_9,其它按鈕按下表設(shè)置屬性:2、按表2添加各運(yùn)算按鈕的消息處理函數(shù)3、為使0到9十個(gè)數(shù)字按鈕響應(yīng)相同的消息處理函數(shù),定義宏on_command_range 4 建立了mfc窗口應(yīng)用

12、程序,找到cvenusdlg.h后加入宏命令5、在頭文件calculatordlg.h中添加類型、成員變量及成員函數(shù)(1)自定義類型enum operator opnone,opadd,opsubtract,opmultiply,opdivide;enum calcerror errnone,errdividebyzero;enum func funcsin, functan, funccos, funcsqrt, funcsqre, funcln, funclog, funcn, funcrec, funcexp, funcnone;(2)成員變量及函數(shù)float m_operand;/存儲

13、當(dāng)前輸入的操作數(shù)float m_accum; /存儲當(dāng)前的計(jì)算結(jié)果bool m_bcoff;/標(biāo)識當(dāng)前輸入是否是小數(shù)float m_coff; /小數(shù)輸入時(shí)的系數(shù)operator m_operator;/enum型變量用以標(biāo)識當(dāng)前運(yùn)算符calcerror m_errorstate; /enum型變量用以標(biāo)識當(dāng)前運(yùn)算狀態(tài)func m_func; /enum型變量用以標(biāo)識當(dāng)前運(yùn)算函數(shù)類型bool m_boperandavail; /標(biāo)識當(dāng)前輸入是否為新輸入數(shù)字void calculate();/處理普通計(jì)算void updatedisplay();/處理顯示void run_func();/處理函

14、數(shù)運(yùn)算(3)為編輯框添加cstring 變量m_result6 在cvenusdlg.cpp中添加在cvenusdlg.cpp添加處理顯示信息的代碼6、在venusdlg.cpp中添加部分變量的初始化cvenusdlg:cvenusdlg(cwnd* pparent /*=null*/): cdialog(cvenusdlg:idd, pparent)/afx_data_init(cvenusdlg) m_result = _t("");/ note: the classwizard will add member initialization here/afx_data_

15、init/ note that loadicon does not require a subsequent destroyicon in win32m_hicon = afxgetapp()->loadicon(idr_mainframe);m_coff=0.1;m_bcoff=0;m_errorstate = errnone;m_boperandavail=false;m_operator=opnone;另:在文件venusdlg.cpp中添加#include "math.h"7、venusdlg.cpp添加各功能代碼(1)數(shù)字輸入消息處理函數(shù)void c ven

16、usdlg:onoperandinput(uint iid)assert(iid >= idc_0 && iid <= idc_9);if(m_errorstate!=errnone)return;if(!m_boperandavail)m_operand=0;if(!m_bcoff)m_operand=m_operand*10+(iid-idc_0);elsem_operand=m_operand+(iid-idc_0)*m_coff;m_coff*=0.1;m_boperandavail=true;updatedisplay();(2)運(yùn)算符消息處理函數(shù)void

17、 c venusdlg:onadd() /加/ todo: add your control notification handler code herecalculate();m_operator=opadd;void c venusdlg:onminus()/減/ todo: add your control notification handler code herecalculate();m_operator=opsubtract;void c venusdlg:onmutiply()/乘/ todo: add your control notification handler cod

18、e herecalculate();m_operator=opmultiply;void c venusdlg:ondivid()/除/ todo: add your control notification handler code herecalculate();m_operator=opdivide;void c venusdlg:onsign() /處理正負(fù)號/ todo: add your control notification handler code herem_operand*=-1;updatedisplay();void c venusdlg:onequal()/處理等號

19、/ todo: add your control notification handler code herecalculate();m_operator=opnone;void c venusdlg:onsqrt()/處理開根號/ todo: add your control notification handler code herem_func=funcsqrt;run_func();void c venusdlg:onrecip() /求倒數(shù)/ todo: add your control notification handler code herem_func=funcrec;run

20、_func();void c venusdlg:onpoint()/處理小數(shù)點(diǎn)/ todo: add your control notification handler code herem_bcoff=1;updatedisplay();void c venusdlg:calculate()/處理計(jì)算if(m_errorstate!=errnone)return;if(m_boperandavail)if(m_operator=opnone)m_accum=m_operand;else if(m_operator=opmultiply)m_accum*=m_operand;else if(m_operator=opdivide)if(m_operand=0)m_errorstate=errdividebyzero;elsem_accum/=m_operand;else if(m_operator=opadd)m_accum+=m_operand;else if(m_operator=opsubtract)m_accum-=m_operand;m_boperandavail=false;m_bcoff=0;m_coff=0.1;updatedisplay();void c venusdlg:run_func()/處理求根和求倒if (m_errorstate !=

溫馨提示

  • 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)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

最新文檔

評論

0/150

提交評論