房屋租售管理系統(tǒng)c程序設(shè)計(jì)1_第1頁
房屋租售管理系統(tǒng)c程序設(shè)計(jì)1_第2頁
房屋租售管理系統(tǒng)c程序設(shè)計(jì)1_第3頁
房屋租售管理系統(tǒng)c程序設(shè)計(jì)1_第4頁
房屋租售管理系統(tǒng)c程序設(shè)計(jì)1_第5頁
已閱讀5頁,還剩34頁未讀 繼續(xù)免費(fèi)閱讀

下載本文檔

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

文檔簡(jiǎn)介

1、程序設(shè)計(jì)報(bào)告( 2012 / 2013 學(xué)年 第 一 學(xué)期)題 目: 房屋租售管理系統(tǒng) 專 業(yè) 學(xué) 生 姓 名 班 級(jí) 學(xué) 號(hào) 指 導(dǎo) 教 師 指 導(dǎo) 單 位 日 期 2012.11.02 評(píng) 分 細(xì) 則評(píng)分項(xiàng)優(yōu)秀良好中等差遵守機(jī)房規(guī)章制度上機(jī)時(shí)的表現(xiàn)學(xué)習(xí)態(tài)度程序準(zhǔn)備情況程序設(shè)計(jì)能力團(tuán)隊(duì)合作精神課題功能實(shí)現(xiàn)情況算法設(shè)計(jì)合理性用戶界面設(shè)計(jì)報(bào)告書寫認(rèn)真程度內(nèi)容詳實(shí)程度文字表達(dá)熟練程度回答問題準(zhǔn)確度簡(jiǎn) 短 評(píng) 語教師簽名: 年 月 日評(píng)分等級(jí)備注評(píng)分等級(jí)有五種:優(yōu)秀、良好、中等、及格、不及格房屋租售管理系統(tǒng)一、 課題內(nèi)容和要求 該系統(tǒng)要求建立某房屋租售中介管理系統(tǒng),并實(shí)現(xiàn)輸入口令進(jìn)入系統(tǒng)、基礎(chǔ)信息建

2、立、客戶統(tǒng)計(jì)、房源排序、銷售業(yè)績(jī)及傭金收入統(tǒng)計(jì)、相關(guān)文件存盤功能。通過此課題,熟練掌握文件、數(shù)組、指針的各種操作,以及一些算法思想的應(yīng)用。二、需求分析模塊一:基礎(chǔ)信息管理,該模塊實(shí)現(xiàn)員工、樓盤及門店信息的查看與建立;模塊二:客戶管理,該模塊實(shí)現(xiàn)客戶信息的建立、查看與各類客戶數(shù)量統(tǒng)計(jì);模塊三:房源查看,該模塊實(shí)現(xiàn)房源信息按租金升序、售金升序、租金降序、售金降序顯示;模塊四:統(tǒng)計(jì)分析,該模塊實(shí)現(xiàn)某一指定時(shí)間段內(nèi)銷售情況及傭金收入統(tǒng)計(jì);模塊五:保存文件,該模塊實(shí)現(xiàn)各類相關(guān)文件的保存;模塊六:退出系統(tǒng),該模塊實(shí)現(xiàn)本系統(tǒng)的退出;三、概要設(shè)計(jì) 開始輸入密碼密碼正確確ny進(jìn)入系統(tǒng)統(tǒng)計(jì)分析保存文件退出系統(tǒng)房源

3、查看客戶管理基礎(chǔ)信息管理123450結(jié)束1.基礎(chǔ)信息管理:包括樓盤信息查詢、員工信息查詢、門店信息查詢、樓盤信息建立、員工信息建立、門店信息建立、返回上級(jí)菜單幾項(xiàng)功能;2.客戶管理:包括客戶信息查詢、客戶信息建立、客戶數(shù)量統(tǒng)計(jì)及返回上級(jí)菜單幾項(xiàng)功能;3.房源查看:包括按租金升序顯示房源信息、按租金降序顯示房源信息、按售金升序顯示房源信息、按售金降序顯示房源信息及返回上級(jí)菜單幾項(xiàng)功能;4.統(tǒng)計(jì)分析:包括銷售情況及傭金收入統(tǒng)計(jì)及返回上級(jí)菜單幾項(xiàng)功能;5.保存文件:保存所有相關(guān)文件;6退出系統(tǒng):退出房屋租售管理系統(tǒng)。四、源程序代碼 #include<iostream>#include&l

4、t;iomanip>#include<fstream>#include<string>#include<stdlib.h>#include<set>using namespace std;class date /定義日期類protected:int year; /年int month; /月int day; /日public:void set(int,int,int); /設(shè)置日期void input(); /輸入日期bool operator<(date ob)const; /重載<運(yùn)算,實(shí)現(xiàn)日期比較int getyear()

5、; /返回年int getmonth(); /返回月int getday(); /返回日 ;/date類函數(shù)的實(shí)現(xiàn)void date:set(int y,int m,int d)year=y;month=m;day=d;void date:input()cout<<"年: "cin>>year;cout<<"月: "cin>>month;cout<<"日: "cin>>day;bool date:operator<(date ob)constif(year&

6、lt;ob.year)return true;else if(year=ob.year)if(month<ob.month)return true;else if(month=ob.month)if(day<ob.day)return true;elsereturn false;else return false;elsereturn false;int date:getyear()return year;int date:getmonth()return month;int date:getday()return day;class floor /定義樓盤類protected:s

7、tring num; /樓盤編號(hào) double size; /樓盤面積 double hire; /樓盤租金 double buy; /樓盤售金 bool state; /樓盤狀態(tài)(1-售,0-租)date da; /租出/售出日期public:floor(string nu,double si,double hi,double bu,bool st,int y,int m,int d); /構(gòu)造函數(shù)void input(); /輸入單個(gè)樓盤信息 bool operator<(floor ob)const; /重載<運(yùn)算,set容器要求元素之間滿足該關(guān)系string getnum(

8、); /返回樓盤編號(hào)double getsize(); /返回樓盤面積 double gethire(); /返回樓盤租金double getbuy(); /返回樓盤售金bool getstate(); /返回樓盤狀態(tài)date getda(); /返回樓盤租出/售出日期;/floor類函數(shù)的實(shí)現(xiàn)floor:floor(string nu,double si,double hi,double bu,bool st,int y,int m,int d)num=nu;size=si;hire=hi;buy=bu;state=st;da.set(y,m,d);void floor:input()cou

9、t<<"樓盤編號(hào): "cin>>num;cout<<endl;cout<<"樓盤面積: "cin>>size;cout<<endl;cout<<"樓盤租金: "cin>>hire;cout<<endl;cout<<"樓盤售金: "cin>>buy;cout<<endl;cout<<"樓盤狀態(tài)(0-租;1-售): "cin>>sta

10、te;cout<<endl;cout<<"租出/售出日期: n"da.input();bool floor:operator<(floor ob)constif(num<ob.num)return true;elsereturn false;string floor:getnum()return num;double floor:getsize()return size;double floor:gethire()return hire;double floor:getbuy()return buy;bool floor:getstate

11、()return state;date floor:getda()return da;class staff /定義員工類protected:string number;/員工編號(hào) string name; /員工姓名char sex; /員工性別string tel; /員工電話 double commission; /員工工資public:staff(string num,string na,char se,string te,double co); /構(gòu)造函數(shù) void input(); /輸入員工信息bool operator<(staff ob)const; /重載<運(yùn)算

12、,set容器要求元素之間滿足該關(guān)系string getnumber(); /返回員工編號(hào)string getname(); /返回員工姓名char getsex(); /返回員工性別string gettel(); /返回員工電話double getcommission(); /返回員工工資;/staff類函數(shù)的實(shí)現(xiàn)staff:staff(string num,string na,char se,string te,double co)number=num;name=na;sex=se;tel=te;commission=co;void staff:input()cout<<&qu

13、ot;員工姓名: "cin>>name;cout<<"員工編號(hào): "cin>>number;cout<<"員工性別("f"或"m"): "cin>>sex;cout<<"員工電話: "cin>>tel;cout<<"員工工資: "cin>>commission;bool staff:operator<(staff ob)constif(number<

14、;ob.number)return true;elsereturn false;string staff:getnumber()return number;string staff:getname()return name;char staff:getsex()return sex;string staff:gettel()return tel;double staff:getcommission()return commission;class store /定義門店類protected:string stonum; /門店編號(hào)int staffnum; /員工數(shù)量int floornum;

15、 /負(fù)責(zé)樓盤數(shù)量public:store(string sn,int st,int fl); /構(gòu)造函數(shù)void input(); /輸入門店信息bool store:operator<(store ob)const; /重載<運(yùn)算,set容器要求元素之間滿足該關(guān)系string getstonum(); /返回門店編號(hào)int getstaffnum(); /返回員工數(shù)量int getfloornum(); /返回負(fù)責(zé)樓盤數(shù)量;/store類函數(shù)的實(shí)現(xiàn)store:store(string sn,int st,int fl)stonum=sn;staffnum=st;floornum=

16、fl;void store:input()cout<<"門店編號(hào): "cin>>stonum;cout<<endl;cout<<"員工數(shù)量: "cin>>staffnum;cout<<endl;cout<<"負(fù)責(zé)樓盤數(shù)量: "cin>>floornum;cout<<endl;bool store:operator<(store ob)constif(stonum<ob.stonum)return true;elser

17、eturn false;string store:getstonum()return stonum;int store:getstaffnum()return staffnum;int store:getfloornum()return floornum;class client /定義客戶類protected:string name; /客戶姓名string number; /客戶編號(hào)char sex; /客戶性別string tel; /客戶電話int type; /客戶類別public:client(string na,string nu,char se,string te,int ty

18、); /構(gòu)造函數(shù)void input(); /輸入客戶信息bool client:operator<(client ob)const; /重載<運(yùn)算,set容器要求元素之間滿足該關(guān)系string getname(); /返回客戶姓名string getnumber(); /返回客戶編號(hào)char getsex(); /返回客戶性別string gettel(); /返回客戶電話int gettype(); /返回客戶類型;/client類函數(shù)實(shí)現(xiàn)client:client(string na,string nu,char se,string te,int ty)name=na;num

19、ber=nu;sex=se;tel=te;type=ty;void client:input()cout<<"客戶姓名: "cin>>name;cout<<"客戶編號(hào): "cin>>number;cout<<"客戶性別("f"或"m"): "cin>>sex;cout<<"客戶電話: "cin>>tel;cout<<"客戶類型(1-求租客戶;2-求售客戶;3-

20、出租客戶;4-出售客戶): "cin>>type;bool client:operator<(client ob)constif(number<ob.number)return true;elsereturn false;string client:getname()return name;string client:getnumber()return number;char client:getsex()return sex;string client:gettel()return tel;int client:gettype()return type;cl

21、ass adminprotected:set<floor> fl; /floor類數(shù)據(jù)集set<staff> sta; /staff類數(shù)據(jù)集set<store> sto; /store類數(shù)據(jù)集set<client> cl; /client類數(shù)據(jù)集 public:admin(); /構(gòu)造函數(shù)void readfloor(); /讀取樓盤文件void readstaff(); /讀取員工文件void readstore(); /讀取門店文件void readclient(); /讀取客戶文件void showfloorinfo(); /顯示所有樓盤信

22、息void showstaffinfo(); /顯示所有員工信息void addfloor(); /添加樓盤信息void addstaff(); /添加員工信息void showstoreinfo(); /顯示所有門店信息void addstore(); /添加門店信息void showclientinfo(); /顯示所有客戶信息void addclient(); /添加客戶信息void hirerise(); /按租金升序顯示所有樓盤信息void hirefall(); /按租金降序顯示所有樓盤信息void buyrise(); /按售金升序顯示所有樓盤信息void buyfall();

23、/按售金降序顯示所有樓盤信息void sellsta(); /某段時(shí)間內(nèi)銷售及傭金收入統(tǒng)計(jì)void clientsta(); /客戶信息統(tǒng)計(jì)void savefloor(); /樓盤信息存檔void savestaff(); /員工信息存檔void savestore(); /門店信息存檔void saveclient(); /客戶信息存檔;admin:admin() /定義對(duì)象的同時(shí)讀取文件readfloor();readstaff();readstore();readclient();void admin:readfloor()ifstream in("c:floorinfo.t

24、xt");if(!in)cout<<"cannot open the file:"floorinfo.txt"n"return ;string num;double size;double hire;double buy;bool state;int y;int m;int d;set<floor>:iterator p=fl.begin();in>>num>>size>>hire>>buy>>state>>y>>m>>d;w

25、hile(!in.eof()floor ob(num,size,hire,buy,state,y,m,d);fl.insert(ob);in>>num>>size>>hire>>buy>>state>>y>>m>>d;in.close();return;void admin:readstaff()ifstream in("c:staffinfo.txt");if(!in)cout<<"cannot open the file:"staffinfo.

26、txt"n"return ;string number;string name;char sex;string tel;double commission;set<staff>:iterator p=sta.begin();in>>number>>name>>sex>>tel>>commission;while(!in.eof()staff ob(number,name,sex,tel,commission);sta.insert(ob);in>>number>>name>

27、>sex>>tel>>commission;in.close();return;void admin:readstore()ifstream in("c:storeinfo.txt");if(!in)cout<<"cannot open the file:"storeinfo.txt"n"return ;string stonum; int staffnum; int floornum;set<store>:iterator p=sto.begin();in>>ston

28、um>>staffnum>>floornum;while(!in.eof()store ob(stonum,staffnum,floornum);sto.insert(ob);in>>stonum>>staffnum>>floornum;in.close();return;void admin:readclient()ifstream in("c:clientinfo.txt");if(!in)cout<<"cannot open the file:"clientinfo.txt&q

29、uot;n"return ;string name; string number; char sex; string tel; int type;set<client>:iterator p=cl.begin();in>>number>>name>>sex>>tel>>type;while(!in.eof()client ob(name,number,sex,tel,type);cl.insert(ob);in>>number>>name>>sex>>tel>

30、>type;in.close();return;void admin:showfloorinfo()system("cls");cout<<"樓盤編號(hào) 樓盤面積 樓盤租金 樓盤售金 樓盤狀態(tài) 租出/售出日期n"set<floor>:iterator p=fl.begin();while(p!=fl.end()cout<<" "<<p->getnum()<<"t "<<p->getsize()<<"t &q

31、uot;<<p->gethire()<<"t "<<p->getbuy()<<"t "if(p->getstate()cout<<"售t "elsecout<<"租t "date bi=p->getda();cout<<bi.getyear()<<"-"<<bi.getmonth()<<"-"<<bi.getday()&l

32、t;<endl;p+;void admin:showstaffinfo()system("cls");cout<<"員工編號(hào)t員工姓名t員工性別t員工電話t員工工資n"set<staff>:iterator p=sta.begin();while(p!=sta.end()cout<<" "<<p->getnumber()<<"tt"<<p->getname()<<"tt "if(p->ge

33、tsex()='f')cout<<"男tt"elsecout<<"女tt"cout<<p->gettel()<<"t "<<p->getcommission()<<"n"p+;void admin:showstoreinfo()system("cls");cout<<"門店編號(hào) 員工數(shù)量 負(fù)責(zé)樓盤數(shù)量n"set<store>:iterator p=sto

34、.begin();while(p!=sto.end()cout<<" "<<p->getstonum()<<"t "<<p->getstaffnum()<<"t "<<p->getfloornum()<<endl;p+;void admin:showclientinfo()system("cls");cout<<"客戶編號(hào) 客戶姓名 客戶性別 客戶電話 客戶類別n"set<cl

35、ient>:iterator p=cl.begin();while(p!=cl.end()cout<<" "<<p->getnumber()<<"t "<<p->getname()<<"t"if(p->getsex()='f')cout<<"男 "elsecout<<"女 "cout<<p->gettel()<<"t"if(

36、p->gettype()=1)cout<<"求租客戶n"else if(p->gettype()=2)cout<<"求售客戶n"else if(p->gettype()=3)cout<<"出租客戶n"elsecout<<"出售客戶n"p+;void admin:addfloor()char ch='n'dofloor ob("1",1,1,1,1,1,1,1);ob.input();fl.insert(ob);co

37、ut<<"繼續(xù)輸入?(y/n)"<<endl;cin>>ch;while(ch='y');void admin:addstaff()char ch='n'dostaff ob("1","1",'1',"1",1);ob.input();sta.insert(ob);cout<<"繼續(xù)輸入?(y/n)"<<endl;cin>>ch;while(ch='y');vo

38、id admin:addstore()char ch='n'dostore ob("1",1,1);ob.input();sto.insert(ob);cout<<"繼續(xù)輸入?(y/n)"<<endl;cin>>ch;while(ch='y');void admin:addclient()char ch='n'doclient ob("1","1",'1',"1",1);ob.input();cl

39、.insert(ob);cout<<"繼續(xù)輸入?(y/n)"<<endl;cin>>ch;while(ch = 'y');void admin:hirerise()int count=0;int i;double r=0;system("cls");cout<<"樓盤編號(hào) 樓盤面積 樓盤租金 樓盤售金 樓盤狀態(tài) 租出/售出日期n"set<floor>:iterator p=fl.begin();while(p!=fl.end() /count用于樓盤計(jì)數(shù)cou

40、nt=count+1;p+;for(i=0;i<count;i+)double min=100000000;p=fl.begin();while(p!=fl.end()if(p->gethire()<min&&r<p->gethire() /提取大于上一輪min值的最小租金min=p->gethire();p+;r=min; /r用于記錄min值p=fl.begin();while(p!=fl.end()if(min=p->gethire() /輸出本輪最小租金的樓盤信息cout<<" "<<

41、p->getnum()<<"t "<<p->getsize()<<"t "<<p->gethire()<<"t "<<p->getbuy()<<"t "if(p->getstate()cout<<"售t "elsecout<<"租t "date bi=p->getda();cout<<bi.getyear()<<

42、;"-"<<bi.getmonth()<<"-"<<bi.getday()<<endl;p+;void admin:hirefall()int count=0;int i;system("cls");cout<<"樓盤編號(hào) 樓盤面積 樓盤租金 樓盤售金 樓盤狀態(tài) 租出/售出日期n"set<floor>:iterator p=fl.begin();while(p!=fl.end()count=count+1;p+;double r=1000000

43、00;for(i=0;i<count;i+)double max=0;p=fl.begin();while(p!=fl.end()if(max<p->gethire()&&r>p->gethire()max=p->gethire();p+;r=max;p=fl.begin();while(p!=fl.end()if(max=p->gethire()cout<<" "<<p->getnum()<<"t "<<p->getsize()<

44、<"t "<<p->gethire()<<"t "<<p->getbuy()<<"t "if(p->getstate()cout<<"售t "elsecout<<"租t "date bi=p->getda();cout<<bi.getyear()<<"-"<<bi.getmonth()<<"-"<<

45、;bi.getday()<<endl;p+;void admin:buyrise()int count=0;int i;system("cls");cout<<"樓盤編號(hào) 樓盤面積 樓盤租金 樓盤售金 樓盤狀態(tài) 租出/售出日期n"set<floor>:iterator p=fl.begin();while(p!=fl.end()count=count+1;p+;double r=0;for(i=0;i<count;i+)double min=100000000;p=fl.begin();while(p!=fl.e

46、nd()if(min>p->getbuy()&&r<p->getbuy()min=p->getbuy();p+;r=min;p=fl.begin();while(p!=fl.end()if(min=p->getbuy()cout<<" "<<p->getnum()<<"t "<<p->getsize()<<"t "<<p->gethire()<<"t "<&

47、lt;p->getbuy()<<"t "if(p->getstate()cout<<"售t "elsecout<<"租t "date bi=p->getda();cout<<bi.getyear()<<"-"<<bi.getmonth()<<"-"<<bi.getday()<<endl;p+;void admin:buyfall()int count=0;int i;sy

48、stem("cls");cout<<"樓盤編號(hào) 樓盤面積 樓盤租金 樓盤售金 樓盤狀態(tài) 租出/售出日期n"set<floor>:iterator p=fl.begin();while(p!=fl.end()count=count+1;p+;double r=100000000;for(i=0;i<count;i+)double max=0;p=fl.begin();while(p!=fl.end()if(max<p->getbuy()&&r>p->getbuy()max=p->g

49、etbuy();p+;r=max;p=fl.begin();while(p!=fl.end()if(max=p->getbuy()cout<<" "<<p->getnum()<<"t "<<p->getsize()<<"t "<<p->gethire()<<"t "<<p->getbuy()<<"t "if(p->getstate()cout<&l

50、t;"售t "elsecout<<"租t "date bi=p->getda();cout<<bi.getyear()<<"-"<<bi.getmonth()<<"-"<<bi.getday()<<endl;p+;void admin:sellsta()date firstday;firstday.set(1900,1,1); /起始日期默認(rèn)1900年1月1日date finalday;finalday.set(1900,1,

51、1); /截至日期默認(rèn)1900年1月1日double money=0; /傭金計(jì)數(shù)int sc=0; /售樓計(jì)數(shù)int hc=0; /租樓計(jì)數(shù)system("cls");cout<<"查詢起始日期: n"firstday.input();cout<<"查詢截至日期: n"finalday.input();set<floor>:iterator p=fl.begin();while(p!=fl.end()if(firstday<p->getda()&&p->getda

52、()<finalday) /篩選起始日期與截至日期之間銷售的樓盤if(p->getstate()money=money+p->getbuy();sc=sc+1;elsemoney=money+p->gethire();hc=hc+1;p+;cout<<"查詢時(shí)間段內(nèi)共n"cout<<"售出: "<<sc<<endl;cout<<"租出: "<<hc<<endl;cout<<"總金額: "<&

53、lt;money<<endl;cout<<"傭金收入(中介費(fèi)3%): "<<money*0.03<<endl;void admin:clientsta()int qz=0;int qs=0;int cz=0;int cs=0;int all=0;system("cls");set<client>:iterator p=cl.begin();while(p!=cl.end()switch(p->gettype()case 1:qz=qz+1;all=all+1;break;case 2:qs

54、=qs+1;all=all+1;break;case 3:cz=cz+1;all=all+1;break;case 4:cs=cs+1;all=all+1;break;p+;cout<<"求租客戶數(shù)量: "<<qz<<endl;cout<<"求售客戶數(shù)量: "<<qs<<endl;cout<<"出租客戶數(shù)量: "<<cz<<endl;cout<<"出售客戶數(shù)量: "<<cs<&l

55、t;endl;cout<<"客戶總數(shù)量: "<<all<<endl;void admin:savefloor()ofstream out("c:floorinfo.txt");if(!out)cout<<"無法打開文件c:floorinfo.txtn"return ;set<floor>:iterator p=fl.begin();while(p!=fl.end()out<<p->getnum()<<" "<<p->getsize()<<" "<<p->gethire()<<" "<<p->getbuy()<<" "<<p->getstate()<<" "date bi=p->getda();out<<bi.getyear()<<" "<<

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(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)論