宾馆房间管理系统
一、问题描述
设计一个程序实现对宾馆房间的基本管理,可以实现:客房信息的录入功能;客人入住登记、客人退房结算;客房信息浏览功能,浏览全部客户的信息,客房信息和客户信息分别保存于不同文件;客房信息查询,查询空房间情况,实现按房间号查询等。
二、基本要求
(1)使用面向对象编程思想编写开发过程中需要用到的类,比如:至少包含四个类:日
期类,客房类,主要包含客房信息(房号类型,是否有客人等)及相关操作;客人类,主要完 成客户信息(身份证,入住时间,姓名,性别等)的相关操作;管理类实现对客房的管理。
(2)输入和输出可以使用文本文件重定向输入(保存数据为磁盘文件);也可以使用标
准输入输出进行(提交时需要提交TXT格式输入数据)。比如:room.txt 的文件,文件中应包含 20 条以上记录(房间的初始状态),guest.txt 的文本文件,包含 10 条以上客人记录。 在运行程序时自动载入。
(3)基本功能要求具有增、删、改、查。
基本流程图
#include<iostream>
#include<fstream>
#include<string>
#include<iomanip>
#include<windows.h>
#include<conio.h>
#define Max 100
using namespace std;
class Data//日期类,记录交易时间
{
public:
Data(){
}//缺省构造函数
~Data(){
}//析构函数
void SetDate(int year,int month,int day)//接收输入的日期
{
this->year=year;
this->month=month;
this->day=day;
}
int getyear(){
return year;
}
int getmonth(){
return month;
}
int getday(){
return day;
}
private:
int year;
int month;
int day;
};
class Room
{
public:
Room *r[Max];//房间对象指针数组
int Room_count; //记录房间数量
Room(int Number,string Type,double Price,string Whether)//构造函数
{
this->Number=Number;
this->Type=Type;
this->Whether=Whether;
this->Price=Price;
}
int InputNumber() {
return Number;}
string InputType(){
return Type;}
string InputWhether(){
return Whether;}
double InputPrice(){
return Price;}
void SetWether(string _state) {
Whether=_state;}
void show() {
cout<<"房号: "<<Number<<"\t"<<"房间类型: "<<Type<<"\t"<<"房间状态: "<<Whether<<"\t"<<"价格: "<<Price<<endl;}
protected:
int Number; //房号
string Type;//类型
string Whether;//是否有客人
double Price;//价格
};
class Guest
{
public:
Guest *g[Max]; //客人对象指针数组
int Guest_count; //记录客人数量
Guest(int number,string Name,int Id,string sex,string Intime,int days) //构造函数
{
this->Name=Name; this->Id=Id; this->sex=sex; this->number=number;
this->Intime=Intime; this->days=days;
}
int InputNumber(){
return number;}
string InputName(){
return Name;}
string InputSex(){
return sex;}
int InputDays(){
return days;}
string InputIntime(){
return Intime;}