1、 程序设计报告 ( 2012 / 2013 学年 第 一 学期) 题 目: 房屋租售管理系统 专 业 学 生 姓 名 班 级 学 号 指 导 教 师 指 导 单 位 日 期 2012.11.02 评 分 细 则 评分项 优秀 良好 中等 差 遵守机房规章制度
2、 上机时的表现 学习态度 程序准备情况 程序设计能力 团队合作精神 课题功能实现情况 算法设计合理性 用户界面设计 报告书写认真程度 内容详实程度 文字表达熟练程度 回答问题准确度 简 短 评 语 教师签名: 年 月 日 评分等级 备注 评分等级有五
3、种:优秀、良好、中等、及格、不及格 房屋租售管理系统 一、 课题内容和要求 该系统要求建立某房屋租售中介管理系统,并实现输入口令进入系统、基础信息建立、客户统计、房源排序、销售业绩及佣金收入统计、相关文件存盘功能。 通过此课题,熟练掌握文件、数组、指针的各种操作,以及一些算法思想的应用。 二、需求分析 模块一:基础信息管理,该模块实现员工、楼盘及门店信息的查看与建立; 模块二:客户管理,该模块实现客户信息的建立、查看与各类客户数量统计; 模块三:房源查看,该模块实现房源信息按租金升序、售金升序、租金降序、售金降序显示; 模块四:统计分析,该模块实
4、现某一指定时间段内销售情况及佣金收入统计; 模块五:保存文件,该模块实现各类相关文件的保存; 模块六:退出系统,该模块实现本系统的退出; 三、概要设计 开始 输入密码 密码正确 确 N Y 进入系统 统计分析 保存文件 退出系统 房源查看 客户管理 基础信息管理 1 2 3 4 5 0 结束 1.基础信息管理:包括楼盘信息查询、员工信息查询、门店信息查询、楼盘信息建立、员工信息建立、门店信息建立、返回上级菜单几项功能; 2.客户
5、管理:包括客户信息查询、客户信息建立、客户数量统计及返回上级菜单几项功能;
3.房源查看:包括按租金升序显示房源信息、按租金降序显示房源信息、按售金升序显示房源信息、按售金降序显示房源信息及返回上级菜单几项功能;
4.统计分析:包括销售情况及佣金收入统计及返回上级菜单几项功能;
5.保存文件:保存所有相关文件;
6.退出系统:退出房屋租售管理系统。
四、源程序代码
#include
6、 using namespace std; class Date //定义日期类 { protected: int year; //年 int month; //月 int day; //日 public: void Set(int,int,int); //设置日期 void Input(); //输入日期 bool operat
7、or<(Date ob)const; //重载<运算,实现日期比较 int GetYear(); //返回年 int GetMonth(); //返回月 int GetDay(); //返回日 }; //Date类函数的实现 void Date::Set(int y,int m,int d) { year=y; month=m; day=d; } void Date::Input() { cout<<"年: "; ci
8、n>>year;
cout<<"月: ";
cin>>month;
cout<<"日: ";
cin>>day;
}
bool Date::operator<(Date ob)const
{
if(year 9、 return false;
else
return false;
else
return false;
}
int Date::GetYear()
{
return year;
}
int Date::GetMonth()
{
return month;
}
int Date::GetDay()
{
return day;
}
class Floor //定义楼盘类
{
protected:
string Num; //楼盘编号
double Size; //楼盘面积
10、
double Hire; //楼盘租金
double Buy; //楼盘售金
bool State; //楼盘状态(1-售,0-租)
Date Da; //租出/售出日期
public:
Floor(string nu,double si,double hi,double bu,bool st,int y,int m,int d); //构造函数
void Input(); //输入单个楼盘信息
bool operator<(Floor ob)const; // 11、重载<运算,set容器要求元素之间满足该关系
string GetNum(); //返回楼盘编号
double GetSize(); //返回楼盘面积
double GetHire(); //返回楼盘租金
double GetBuy(); //返回楼盘售金
bool GetState(); //返回楼盘状态
Date GetDa(); //返回楼盘租出/售出日期
};
//Floor类函数的实现
Floor::Floor(string n 12、u,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()
{
cout<<"楼盘编号: ";
cin>>Num;
cout< 13、<<"楼盘售金: ";
cin>>Buy;
cout< 14、)
{
return Size;
}
double Floor::GetHire()
{
return Hire;
}
double Floor::GetBuy()
{
return Buy;
}
bool Floor::GetState()
{
return State;
}
Date Floor::GetDa()
{
return Da;
}
class Staff //定义员工类
{
protected:
string Number; //员工编号
string Name; //员工姓 15、名
char Sex; //员工性别
string Tel; //员工电话
double Commission; //员工工资
public:
Staff(string num,string na,char se,string te,double co); //构造函数
void Input(); //输入员工信息
bool operator<(Staff ob)const; //重载<运算,set容器要求元素之间满足该关系
string GetNumber(); 16、 //返回员工编号
string GetName(); //返回员工姓名
char GetSex(); //返回员工性别
string GetTel(); //返回员工电话
double GetCommission(); //返回员工工资
};
//Staff类函数的实现
Staff::Staff(string num,string na,char se,string te,double co)
{
17、 Number=num;
Name=na;
Sex=se;
Tel=te;
Commission=co;
}
void Staff::Input()
{
cout<<"员工姓名: ";
cin>>Name;
cout<<"员工编号: ";
cin>>Number;
cout<<"员工性别(\"f\"或\"m\"): ";
cin>>Sex;
cout<<"员工电话: ";
cin>>Tel;
cout<<"员工工资: ";
cin>>Commission;
}
bool Staff::operator<(Staff ob)con 18、st
{
if(Number 19、mission;
}
class Store //定义门店类
{
protected:
string StoNum; //门店编号
int StaffNum; //员工数量
int FloorNum; //负责楼盘数量
public:
Store(string sn,int st,int fl); //构造函数
void Input(); //输入门店信息
bool Store::operator<(Store ob)const; 20、 //重载<运算,set容器要求元素之间满足该关系
string GetStoNum(); //返回门店编号
int GetStaffNum(); //返回员工数量
int GetFloorNum(); //返回负责楼盘数量
};
//Store类函数的实现
Store::Store(string sn,int st,int fl)
{
StoNum=sn;
StaffNum=st;
FloorNum=fl;
}
void Stor 21、e::Input()
{
cout<<"门店编号: ";
cin>>StoNum;
cout< 22、
return StoNum;
}
int Store::GetStaffNum()
{
return StaffNum;
}
int Store::GetFloorNum()
{
return FloorNum;
}
class Client //定义客户类
{
protected:
string name; //客户姓名
string number; //客户编号
char sex; //客户性别
string tel; //客户电话
int type; 23、 //客户类别
public:
Client(string na,string nu,char se,string te,int ty); //构造函数
void Input(); //输入客户信息
bool Client::operator<(Client ob)const; //重载<运算,set容器要求元素之间满足该关系
string GetName(); //返回客户姓名
strin 24、g GetNumber(); //返回客户编号
char GetSex(); //返回客户性别
string GetTel(); //返回客户电话
int GetType(); //返回客户类型
};
//Client类函数实现
Client::Client(string na,string nu,char se,string te,int ty)
{ 25、
name=na;
number=nu;
sex=se;
tel=te;
type=ty;
}
void Client::Input()
{
cout<<"客户姓名: ";
cin>>name;
cout<<"客户编号: ";
cin>>number;
cout<<"客户性别(\"f\"或\"m\"): ";
cin>>sex;
cout<<"客户电话: ";
cin>>tel;
cout<<"客户类型(1-求租客户;2-求售客户;3-出租客户;4-出售客户): ";
cin>>type;
}
bool Client::op 26、erator<(Client ob)const
{
if(number 27、)
{
return type;
}
class Admin
{
protected:
set 28、 //读取楼盘文件
void ReadStaff(); //读取员工文件
void ReadStore(); //读取门店文件
void ReadClient(); //读取客户文件
void ShowFloorInfo(); //显示所有楼盘信息
void ShowStaffInfo(); //显示所有员工信息
void AddFloor(); //添加楼盘信息
void AddStaff(); //添加员工信息
void Sho 29、wStoreInfo(); //显示所有门店信息
void AddStore(); //添加门店信息
void ShowClientInfo(); //显示所有客户信息
void AddClient(); //添加客户信息
void HireRise(); //按租金升序显示所有楼盘信息
void HireFall(); //按租金降序显示所有楼盘信息
void BuyRise(); //按售金升序显示所有楼盘信息
void BuyFa 30、ll(); //按售金降序显示所有楼盘信息
void SellSta(); //某段时间内销售及佣金收入统计
void ClientSta(); //客户信息统计
void SaveFloor(); //楼盘信息存档
void SaveStaff(); //员工信息存档
void SaveStore(); //门店信息存档
void SaveClient(); //客户信息存档
};
Admin::Admin() 31、 //定义对象的同时读取文件
{
ReadFloor();
ReadStaff();
ReadStore();
ReadClient();
}
void Admin::ReadFloor()
{
ifstream in("C:\\FloorInfo.txt");
if(!in)
{
cout<<"Cannot open the file:\"FloorInfo.txt\"\n";
return ;
}
string Num;
double Size;
double Hire;
double Buy;
32、 bool State;
int y;
int m;
int d;
set 33、taff()
{
ifstream in("C:\\StaffInfo.txt");
if(!in)
{
cout<<"Cannot open the file:\"StaffInfo.txt\"\n";
return ;
}
string Number;
string Name;
char Sex;
string Tel;
double Commission;
set 34、eof())
{
Staff ob(Number,Name,Sex,Tel,Commission);
sta.insert(ob);
in>>Number>>Name>>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 ;
}
st 35、ring StoNum;
int StaffNum;
int FloorNum;
set 36、t()
{
ifstream in("C:\\ClientInfo.txt");
if(!in)
{
cout<<"Cannot open the file:\"ClientInfo.txt\"\n";
return ;
}
string name;
string number;
char sex;
string tel;
int type;
set 37、ype;
while(!in.eof())
{
Client ob(name,number,sex,tel,type);
cl.insert(ob);
in>>number>>name>>sex>>tel>>type;
}
in.close();
return;
}
void Admin::ShowFloorInfo()
{
system("cls");
cout<<"楼盘编号 楼盘面积 楼盘租金 楼盘售金 楼盘状态 租出/售出日期\n";
set 38、fl.end())
{
cout<<" "< 39、d Admin::ShowStaffInfo()
{
system("cls");
cout<<"员工编号\t员工姓名\t员工性别\t员工电话\t员工工资\n";
set 40、Tel()<<"\t "< 41、p++;
}
}
void Admin::ShowClientInfo()
{
system("cls");
cout<<"客户编号 客户姓名 客户性别 客户电话 客户类别\n";
set 42、< 43、
fl.insert(ob);
cout<<"继续输入?(y/n)"< 44、'n';
do
{
Store ob("1",1,1);
ob.Input();
sto.insert(ob);
cout<<"继续输入?(y/n)"< 45、e(ch == 'y');
}
void Admin::HireRise()
{
int count=0;
int i;
double r=0;
system("cls");
cout<<"楼盘编号 楼盘面积 楼盘租金 楼盘售金 楼盘状态 租出/售出日期\n";
set 46、i 47、n==p->GetHire()) //输出本轮最小租金的楼盘信息
{
cout<<" "< 48、GetMonth()<<"-"< 49、
for(i=0;i 50、Size()<<"\t "<






