酒店房间登记与计费管理系统设计程序设计说明书Word文件下载.docx
《酒店房间登记与计费管理系统设计程序设计说明书Word文件下载.docx》由会员分享,可在线阅读,更多相关《酒店房间登记与计费管理系统设计程序设计说明书Word文件下载.docx(23页珍藏版)》请在冰豆网上搜索。
选择“1。
按天入住”按天数计费,会显示目前空置的房间.输入所选房间已进行下一步操作:
1。
4
如选择“2。
按小时入住”则按小时计费,操作同理.
图2.1。
5
之后会进入下一界面并提示登记成功。
6
如在主界面选择“2。
查询房间的入住情况”则会进入查询房间状况界面,程序将分别依次显示已入住的房间和空置房间。
图2。
1.7
如在主界面选择“3。
查询当前费用”则会进入用户查询界面,输入顾客姓名即可进行查询
1.8
程序会显示该客人的相关信息
图2.1.9
如在主界面选择“4.结账退房"则会进入用户退房界面,输入顾客姓名即可进行退房操作
1.10
输入成功后会显示退房成功。
图2.1。
11
在主界面选择“5.退出程序”会进入退出界面。
图2.1。
12
2.2软件的数据(结构)设计
本软件运用了C语言文件的读取与写入功能,各文件的作用如下:
count.txt:
用于存储房客数量,内部存储一个int*数据。
room。
txt:
用于存储房间信息,内部依次存储:
房间状态char*(1位) 房间号char*(4位)房间类型char*(1位)
房间描述char*(6位)房间日租金int* 房间月租金int*。
customer.txt:
用于存储房客信息,内部依次存储:
姓名char* 证件类型char*证件号码int*房间号char*(4位)房租int*押金int*
3软件的算法设计
3.1软件模块图
3.2程序流程图
客房查询模块:
顾客查询模块:
结账退房模块:
3 软件的实现
1使用的结构数组及函数的定义
结构体定义:
typedefstruct room //客房信息
{
char FID[5];
//房间号
ﻩchartype[2];
//客房类型
chardescribe[7];
//该客房类型的描述
ﻩintcost_d;
//日收费
ﻩintcost_h;
//时收费
ﻩcharstatu[2];
//入住情况
}room;
typedefstructcustomer//入住记录
{
charFID[5];
//房间号
ﻩcharname[20];
//名字
chartype[14];
//证件类型
ﻩint ID;
//证件号
int pay;
//房费
ﻩintcp;
//押金
}customer;
函数定义:
voidrent(room*p);
//登记入住模块
void search_room(room *p);
//客房查询模块
voidsearch_customer(room*p,intl);
//费用查询模块
voidpay(room *p,intl);
//结账模块
3.2登记入住模块
源文件:
voidrent(room*p)
int i,count,n,m=2;
structroomrm[max]={0};
//定义结构数组
struct customercs;
ﻩchar search[2]={'Y’},stu[2]={’N’},dill[5]={0};
ﻩ
FILE*fpin,*fpout;
fpout=fopen("
customer.txt”,"
a”);
assert(fpout !
= NULL);
ﻩprintf(”请输入姓名:
”);
ﻩscanf(”%s”,&cs.name);
fprintf(fpout,”%s”,cs。
name);
ﻩprintf("
请填入证件类型:
scanf(”%s"
&cs。
type);
fprintf(fpout,"%s"
cs.type);
ﻩprintf(”请输入证件号码:
"
);
scanf("
%d"
,&cs.ID);
fprintf(fpout,"%d”,cs.ID);
ﻩprintf(”请选择入住方式:
\n1.按天入住\n2.按小时入住\n"
);
scanf(”%d",&
count);
ﻩfpin=fopen("
room.txt"
”r+"
assert(fpin!
=NULL);
ﻩprintf("
以下是现有的空房\n”);
for(i=0;
i〈max;
i++) //对结构数组赋值,录入房间信息
ﻩ{
fscanf(fpin,"%s"
,rm[i]。
statu);
fscanf(fpin,”%s "
,rm[i]。
FID);
fscanf(fpin,”%s ”,rm[i].type);
fscanf(fpin,"
%s"
,rm[i]。
describe);
fscanf(fpin,"
%d"
,&rm[i].cost_d);
ﻩfscanf(fpin,"
%d",&rm[i].cost_h);
}
ﻩfclose(fpin);
for(i=0;
i<
max;
i++)
{
ﻩif(strcmp(search,rm[i]。
statu)==0)
ﻩprintf("%s号%s型%s日收费:
%d时收费:
%d\n”,rm[i]。
FID,rm[i]。
type,rm[i]。
describe,rm[i]。
cost_d,rm[i].cost_h);
}
}
ﻩprintf("
请输入要入住的房屋"
ﻩscanf(”%s”,&dill);
for(i=0;
i〈max;
i++)
ﻩ{
ﻩﻩif(strcmp(dill,rm[i]。
FID)==0)//所选房间号与房间数据对比
ﻩﻩ{
strcpy(rm[i].statu,stu);
//更改数组中的房间状态
ﻩfprintf(fpout,”%s ”,rm[i].FID);
if(count==1)
ﻩ{
ﻩﻩprintf(”请选择天数:
");
ﻩﻩ scanf("%d”,&
n);
ﻩﻩfprintf(fpout,"%d”,rm[i].cost_d*n);
ﻩfprintf(fpout,"
%d"
rm[i].cost_d*n*m);
system(”cls”);
ﻩ printf(”\004已成功登记房间!
\n"
ﻩ printf(”\004您的房号为:
%s\n"
rm[i]。
FID);
ﻩﻩﻩprintf(”\004请支付%d元的房费以及押金%d元.\n”,rm[i].cost_d*n,rm[i].cost_d*n*m);
}
ﻩ else
ﻩ {
printf(”请选择小时数:
”);
ﻩﻩﻩscanf("%d"
,&n);
ﻩﻩ fprintf(fpout,"%d"
cost_h*n);
fprintf(fpout,"
%d ",rm[i]。
cost_h*n*m);
system(”cls”);
ﻩ printf(”\004已成功登记房间!
\n"
ﻩﻩﻩ printf(”\004您的房号为:
%s\n"
rm[i].FID);
ﻩprintf(”\004请支付%d元的房费以及押金%d元。
rm[i].cost_h*n,rm[i].cost_h*n*m);
ﻩ }
ﻩﻩ
ﻩﻩ}
ﻩ}
ﻩfpin=fopen("
room。
txt”,"
w");
ﻩfor(i=0;
i<max;
i++) //将更改录入文件
fprintf(fpin,"%s "
,rm[i].statu);
fprintf(fpin,"
%s",rm[i]。
FID);
fprintf(fpin,”%s"
,rm[i]。
type);
ﻩfprintf(fpin,"%s"
,rm[i].describe);
ﻩ fprintf(fpin,”%d ”,rm[i].cost_d);
fprintf(fpin,”%d\n”,rm[i].cost_h);
fclose(fpout);
fclose(fpin);
}
3查询房间模块
void search_room(room *p)
ﻩinti,h,k;
ﻩstructroomrm[max]={0};
ﻩcharsearch[2]={'
Y’};
ﻩFILE*fpin;
fpin =fopen(”room。
txt”,"
r"
ﻩassert(fpin!
= NULL);
ﻩfor(i=0;
i<
i++) //对结构数组赋值,即录入房间信息
fscanf(fpin,"
rm[i]。
statu);
fscanf(fpin,"
%s”,rm[i].FID);
fscanf(fpin,"
%s ”,rm[i]。
type);
fscanf(fpin,”%s ”,&
rm[i].describe);
ﻩ fscanf(fpin,”%d"
&
rm[i]。
cost_d);
ﻩ fscanf(fpin,"%d”,&rm[i]。
cost_h);
ﻩ
ﻩprintf("
目前的空置房间有:
//查询空客房
for(h=0;
h<
max;
h++) //显示结果
if(strcmp(search,rm[h]。
statu)==0)
printf("
%s号%s型房间\n"
rm[h].FID,rm[h]。
ﻩprintf(”有顾客入住的房间:
//查询满客房
for(k=0;
k<
k++) //显示结果
if(strcmp(search,rm[k]。
statu)!
=0)
printf(”%s号%s 型房间\n"
rm[k].FID,rm[k]。
ﻩfclose(fpin);
4查询房客模块
voidsearch_customer(room*p,int l)//参数l的值即为主函数所读取的客人数量
char name[20];
inta;
ﻩinti;
structcustomercs[20]={0};
FILE*fpin,*fp1;
printf(”请输入要查询的用户姓名:
scanf("%s”,&
name);
fpin=fopen("
customer.txt"
”r"
ﻩassert(fpin!
=NULL);
ﻩfp1=fopen("
count.txt"
”r”);
ﻩassert(fp1 !
=NULL);
for(i=0;
l;
i++) //读取顾客数据
{
ﻩfscanf(fpin,”%s",&cs[i].name);
ﻩﻩfscanf(fpin,”%s ”,&cs[i].type);
fscanf(fpin,"
%d"
,&cs[i]。
ID);
ﻩfscanf(fpin,”%s”,&cs[i].FID);
fscanf(fpin,"
%d”,&cs[i].pay);
ﻩﻩfscanf(fpin,”%d"
,&
cs[i]。
cp);
ﻩfor(a=0;
a<
l;
a++)
ﻩif(strcmp(name,cs[a].name)==0)//比较与所输入字符串与是否一致
ﻩ{
ﻩprintf(”%s"
cs[a].name);
ﻩﻩprintf("
%s”,cs[a].type);
ﻩprintf("%d",cs[a]。
ID);
ﻩﻩﻩprintf(”%s ",cs[a].FID);
ﻩprintf(”%d”,cs[a].pay);
ﻩﻩprintf("%d\n”,cs[a]。
cp);
ﻩﻩ}
ﻩfclose(fpin);
fclose(fp1);
}
5结账退房模块
voidpay(room*p,intl)
inti,j;
ﻩcharname[20];
charFID[5];
char stu[2]={'
Y'};
ﻩstructroomrm[max]={0};
structcustomercs[20]={0};
ﻩFILE*fp1,*fp2;
printf("请输入客人姓名:
ﻩscanf(”%s”,&name);
ﻩfp1=fopen(”room.txt","r”);
ﻩassert(fp1);
ﻩfp2=fopen(”customer。
txt"
,"
r”);
ﻩassert(fp2);
ﻩfor(i=0;
i〈max;
i++)//对结构数组赋值
fscanf(fp1,"
%s ”,&
rm[i]。
statu);
fscanf(fp1,”%s”,&
rm[i].FID);
fscanf(fp1,"%s”,&
rm[i]。
type);
fscanf(fp1,”%s”,&
rm[i]。
describe);
ﻩ fscanf(fp1,"
%d”,&rm[i].cost_d);
ﻩfscanf(fp1,”%d",&rm[i].cost_h);
ﻩ}
ﻩfclose(fp1);
for(j=0;
j<
j++)
ﻩfscanf(fp2,"
%s "
cs[j].name);
ﻩfscanf(fp2,”%s ",&cs[j]。
type);
ﻩfscanf(fp2,"
%d”,&
cs[j]。
ID);
ﻩﻩfscanf(fp2,"
%s”,&cs[j]。
ﻩfscanf(fp2,"
&cs[j].pay);
ﻩfscanf(fp2,"
cs[j].cp);
ﻩfclose(fp2);
for(j=0;
j<
j++)
ﻩif(strcmp(name, cs[j].name) ==0)
{
strcpy(FID,cs[j]。
FID);
ﻩﻩfor(;
j〈l—1;
j++)
ﻩﻩ{
ﻩﻩ
ﻩ cs[j]=cs[j+1];
//为数组重新赋值以完成删除操作
ﻩﻩ
ﻩﻩ}
}
fp2=fopen("
customer。
txt”,"
w”);
assert(fp2);
for(j=0;
j〈l-1;
printf("
%s"
cs[j].name);
printf(”%s”,cs[j].type);
ﻩprintf(”%d”,cs[j]。
ﻩﻩprintf("
cs[j]。
FID);
ﻩprintf("
%d "
cs[j]。
pay);
ﻩprintf(”%d\n”,cs[j]。
for(j=0;
l—1;
ﻩﻩfprintf(fp2,"
%s "
cs[j].name);
ﻩfprintf(fp2,”%s ”,cs[j].type);
ﻩfprintf(fp2,”%d"
,cs[j]。
ID);
ﻩﻩfprintf(fp2,"
%s"
cs[j]。
FID);
fprintf(fp2,”%d "
cs[j].pay);
ﻩfprintf(fp2,”%d\n"
cs[j].cp);
ﻩfclose(fp2);
for(i=0;
i++)
if(strcmp(FID,rm[i]。
FID)==0)
{
ﻩﻩﻩstrcpy(rm[i].statu,stu);
fp1=fopen(”room.txt”,"w”);
//打开并清空文件
assert(fp1);
ﻩfor(i=0;
i<max;
i++) //重新录入全部信息来完成更改
ﻩ fprintf(fp1,"
%s ”,rm[i].statu);
ﻩ fprintf(fp1,”%s"
,rm[i]。
fprintf(fp1,"
,rm[i].type);
ﻩ fprintf(fp1,"
%s "
rm[i]。
describe);
,rm[i]。
cost_d);
fprintf(fp1,”%d\n",rm[i].cost_h);
ﻩfclose(fp1);
4软件测试
1、 voidrent(room*p)//登记入住函数
用例:
input:
rooma[20] output:
请输入姓名
input:
DANNY output:
请输入证件类型
input:
id output:
请输入证件号码
input:
10086 output:
请选择入住方式:
按天入住
2。
按小时入住
input:
2 output:
以下是现有的空房:
A101号A型SINGLE日租金150时租金20
请输入要入住的房屋
input:
A101 output:
请选择小时数
input:
5 output:
已成功登记房间
您的房号为:
A101
请支付100元的房租及押金200元
2、void search_room(room*p)//住房查询函数
用例:
input:
rooma[20] output:
目前的空置房间有:
A102号B型SINGLE日租金150时租金20
A105号C型SINGLE日租金300时租金40
有顾客入住的房间:
B104号C型SINGLE日租金300时租金40
3、 voidsearch_customer(room *p,intl)//房客查询函数
input:
rooma[20]j=3output:
请输入要查询的用户姓名:
input:
DANNY output:
DANNYid10086A101100200
4、voidpay(room*p,intl)//结账退房函数
input:
rooma[20]j=3output:
input:
DANNY output:
已成功退房
5软件使用说明书
本程序是专门为酒店设计的管理系统,方便操作员的操作.
通过主界面,我们可以进行登记、查询房间、查询费用、退房及退出等操作。
通过登记界面,可以实现用户登记及住房登记、调整等功能。
通过费用查询界面,可以通过姓名查找顾客的入住信息。
通过房间查询界面,可以查找房间的使用情况。
通过退房界面,仅通过输入姓名就可以完成退房。
致谢
此次的程序设计题目做的很是辛苦。
由于本人基础很差,所以花费了大量的时间,但最后总算成功完成。
这与老师的耐心指导是分不开的,同时我也在老师身上学到不少东西。
因此特在此对我的任课老师表示感谢!
同时也要感谢所有帮助过我的同学.