語言課程設(shè)計(jì)酒店房間登記與計(jì)費(fèi)管理系統(tǒng)總結(jié)報(bào)告_第1頁
語言課程設(shè)計(jì)酒店房間登記與計(jì)費(fèi)管理系統(tǒng)總結(jié)報(bào)告_第2頁
語言課程設(shè)計(jì)酒店房間登記與計(jì)費(fèi)管理系統(tǒng)總結(jié)報(bào)告_第3頁
語言課程設(shè)計(jì)酒店房間登記與計(jì)費(fèi)管理系統(tǒng)總結(jié)報(bào)告_第4頁
語言課程設(shè)計(jì)酒店房間登記與計(jì)費(fèi)管理系統(tǒng)總結(jié)報(bào)告_第5頁
已閱讀5頁,還剩14頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

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

文檔簡介

1、C語言程序設(shè)計(jì)課程設(shè)計(jì)報(bào)告設(shè)計(jì)題目:酒店房間登記與計(jì)費(fèi)管理系統(tǒng)班 級 自126 姓 名 李帥 學(xué) 號 3120411146 指導(dǎo)教師 徐開亮 2013 年 春季 學(xué)期設(shè)計(jì)任務(wù):酒店房間登記與計(jì)費(fèi)管理系統(tǒng)題目:酒店房間登記與計(jì)費(fèi)管理系統(tǒng)功能:1、屏幕上出現(xiàn)一個(gè)界面,讓操作員能夠方便的選擇所需要進(jìn)行的操作,包括登記入住、查詢房間的入住情況、查詢當(dāng)前費(fèi)用、結(jié)賬退房等操作。 登記入住的信息主要有:客人姓名、房間號、入住時(shí)間、計(jì)費(fèi)方式(按天或小時(shí))、單價(jià)、押金 房間信息:房間號、是否有人入住、房間標(biāo)準(zhǔn)、每天單價(jià)、小時(shí)單價(jià)2、對不同標(biāo)準(zhǔn)的房間實(shí)施不同的收費(fèi)標(biāo)準(zhǔn),也可以按天收費(fèi)或按小時(shí)收費(fèi),可根據(jù)顧客需要在

2、登記的入住的時(shí)候進(jìn)行選擇。 3、在結(jié)賬退房時(shí),根據(jù)入住的時(shí)間,計(jì)費(fèi)方式和房間單價(jià)計(jì)算出總費(fèi)用。4、保存:將相關(guān)數(shù)據(jù)寫入磁盤文件,便于存、取操作。分步實(shí)施: 1、初步完成總體設(shè)計(jì),搭好框架,確定人機(jī)對話的界面,確定函數(shù)個(gè)數(shù); 2、完成最低要求:建立房間列表,完成登記入住、查詢房間入住情況等功能。 3、進(jìn)一步要求:完成計(jì)費(fèi)和費(fèi)用查詢功能; 每次登錄時(shí)讀取保存在磁盤文件中的入住情況。平時(shí):驗(yàn)收:報(bào)告:總評成績:指導(dǎo)教師簽名:附:酒店房間登記與計(jì)費(fèi)管理系統(tǒng)源代碼#define M 80#include<stdlib.h>#include<stdio.h>#include<

3、string.h>/*函數(shù)聲明*/void check_in(); /*登記入住函數(shù)*/void chamber(); /*入住情況函數(shù)*/void price(); /*當(dāng)前費(fèi)用函數(shù)*/void fee(); /*結(jié)賬退房函數(shù)*/void infor(); /*信息查詢函數(shù)*/void save(int); /*保存信息函數(shù)*/void read(int); /*讀取信息函數(shù)*/ void choice(); /*功能選擇函數(shù)*/int judge_year(int); /*判斷閏年函數(shù)*/void information(); /*輸出全部房間信息*/*結(jié)構(gòu)體*/struct tim

4、eint year; int mon;int date;int hour; struct room /*定義各房間信息的結(jié)構(gòu)體*/char name40;char ID18;int flag; /* 0-無人入住,1-按小時(shí)計(jì)費(fèi),2-按天計(jì)費(fèi) */long int deposit;time t2; /* 0-入住時(shí)間,1-當(dāng)前時(shí)間 */ roomM;char c140=0;char c218=0;/*主函數(shù)(主界面)*/void main()system("cls"); /*清屏*/system("color 4E");int n;printf(&quo

5、t;*");printf("* *");printf("*tt - 歡迎光臨萬豪酒店 - *");printf("* *");printf("*nn");printf("ttt 1. 登記入住 nn");printf("ttt 2. 入住情況 nn");printf("ttt 3. 當(dāng)前費(fèi)用 nn");printf("ttt 4. 結(jié)賬退房 nn");printf("ttt 5. 信息查詢 nn");pri

6、ntf("ttt 6. 全部信息 nn");printf("ttt 7. 退出系統(tǒng) nn");printf("請輸入您需要的服務(wù)的代碼:");scanf("%d",&n);while(n<1|n>7) printf("nn代碼輸入有誤,請您重新輸入:"); scanf("%d",&n); switch(n) /*根據(jù)輸入數(shù)字選擇功能*/ case 1:check_in();break; /*調(diào)用登記入住函數(shù)*/ case 2:chamber();b

7、reak; /*調(diào)用房間情況函數(shù)*/ case 3:price();break; /*調(diào)用當(dāng)前費(fèi)用函數(shù)*/ case 4:fee();break; /*調(diào)用結(jié)賬退房函數(shù)*/ case 5:infor();break; /*調(diào)用信息查詢函數(shù)*/ case 6:information();break; case 7:exit(0); /*調(diào)用退出系統(tǒng)函數(shù)*/*查看房間使用情況函數(shù)*/void chamber() system("cls"); /*清屏*/system("color 4E");printf("n*房間使用情況*n");int

8、 count=0;int i;int j;int k;int m;for(i=1;i<=80;i+) /*統(tǒng)計(jì)未入住房間總數(shù)*/read(i);if(roomi-1.flag=0) count+;printf("當(dāng)前未使用房間數(shù):%dnnn",count);chaxun:printf("請輸入你要查詢的房間號(1-40:單人間,41-80:雙人間):"); /*輸入房間號查詢房間入住情況*/scanf("%d",&m);while(m<1|m>80) printf("nn房間號輸入有誤,請您重新輸入

9、:"); scanf("%d",&m); read(m);while(roomm-1.flag!=0) printf("nn對不起,該房間已有客人入住,請輸入其他房間號:"); scanf("%d",&m);read(m);printf("nn該房間沒有客人入住,您要入住該房間嗎?(1-是,2-否):");scanf("%d",&j);while(j<1|j>2)printf("nn您的選擇輸入有誤,請您重新輸入:");scanf

10、("%d",&j);if(j=1)check_in();elseprintf("nn您需要繼續(xù)查詢嗎?(1-是,2-否):");scanf("%d",&k);while(k<1|k>2)printf("nn您的選擇輸入有誤,請您重新輸入:");scanf("%d",&k);if(k=1)goto chaxun;elseprintf("nn");main();/*登記入住函數(shù)*/void check_in()system("cls&

11、quot;); /*清屏*/system("color 4E");int i;int j;int l;int k;int tab212=31,28,31,30,31,30,31,31,30,31,30,31,31,29,31,30,31,30,31,31,30,31,30,31;printf("n*登記入住*n");printf("請輸入您將入住的房間號:");scanf("%d",&i);while(i<1|i>80) printf("nn房間號輸入有誤,請您重新輸入:")

12、; scanf("%d",&i); read(i);while(roomi-1.flag!=0) /*判斷房間是否入住*/ printf("nn對不起,該房間已有客人入住,請輸入其他房間號:"); scanf("%d",&i);read(i);printf("nn請輸入您的姓名:"); /*客人信息登記*/scanf("%s",);j=strlen();while(j<0)printf("nn您的姓名輸入有誤,請您重

13、新輸入:n"); scanf("%s",); j=strlen(); printf("nn請輸入您的證件號碼:");scanf("%s",roomi-1.ID);j=strlen(roomi-1.ID);while(j!=18)printf("nn您的證件號碼輸入有誤,請您重新輸入:n"); scanf("%s",roomi-1.ID); j=strlen(roomi-1.ID); if(i<=40) printf("nn

14、您選擇的是單人間,該房間148元/天,8元/小時(shí)。nnn"); /*選擇計(jì)費(fèi)方式*/ printf("請選擇您的計(jì)費(fèi)方式(1:按小時(shí)計(jì)費(fèi),2:按天計(jì)費(fèi)):");else printf("nn您選擇的是雙人間,該房間128元/天,7元/小時(shí)。nnn"); printf("請選擇您的計(jì)費(fèi)方式(1:按小時(shí)計(jì)費(fèi),2:按天計(jì)費(fèi)):");scanf("%d",&roomi-1.flag);while(roomi-1.flag<0|roomi-1.flag>2)printf("nn您的計(jì)費(fèi)

15、方式輸入有誤,請您重新輸入:");scanf("%d",&roomi-1.flag);printf("nn請按所示格式輸入您的入住時(shí)間(年-月-日-時(shí),時(shí)為24小時(shí)制):");scanf("%d-%d-%d-%d",&roomi-1.t0.year,&roomi-1.t0.mon,&roomi-1.t0.date,&roomi-1.t0.hour);l=judge_year(roomi-1.t0.year);while(roomi-1.t0.year<=0)|(roomi-1.t

16、0.mon<=0|roomi-1.t0.mon>12)|(roomi-1.t0.date<=0|roomi-1.t0.date>tablroomi-1.t0.mon-1)|(roomi-1.t0.hour<0|roomi-1.t0.hour>=24)printf("nn您的入住時(shí)間輸入有誤,請按照格式重新輸入:");scanf("%d-%d-%d-%d",&roomi-1.t0.year,&roomi-1.t0.mon,&roomi-1.t0.date,&roomi-1.t0.hour)

17、;l=judge_year(roomi-1.t0.year);printf("nn請輸入您的押金數(shù)額:");scanf("%ld",&roomi-1.deposit);while(roomi-1.deposit<=0)printf("nn您的押金數(shù)額輸入有誤,請您重新輸入:n");scanf("%ld",&roomi-1.deposit);printf("nn您是否確定您的信息:(1-是,2-否):");scanf("%d",&k);while(

18、k<1|k>2)printf("nn您的選擇輸入有誤,請您重新輸入:n");scanf("%d",&k);if(k=1)printf("nn您已登記入住成功,祝您在本店住得愉快!nn");save(i);choice();elsecheck_in();/*費(fèi)用查詢函數(shù)*/void price()system("cls"); /*清屏*/system("color 4E");printf("n*費(fèi)用查詢*n");int i;int j;int k;int t

19、ab212=31,28,31,30,31,30,31,31,30,31,30,31,31,29,31,30,31,30,31,31,30,31,30,31;int day=0;int hr=0;int total_hour;int total_day;long int price;printf("請輸入您的房間號:");scanf("%d",&i);while(i<1|i>80) printf("nn您的房間號輸入有誤,請您重新輸入:"); scanf("%d",&i); read(i)

20、;while(roomi-1.flag=0) /*判斷房間是否已有客人入住*/printf("nn該房間無人入住,請重新輸入您的房間號:");scanf("%d",&i);read(i);printf("nn請按所示格式輸入當(dāng)前時(shí)間(年-月-日-時(shí),時(shí)為24小時(shí)制):"); /*輸入當(dāng)前時(shí)間*/shuru:scanf("%d-%d-%d-%d",&roomi-1.t1.year,&roomi-1.t1.mon,&roomi-1.t1.date,&roomi-1.t1.hour

21、);j=judge_year(roomi-1.t1.year);while(roomi-1.t1.year<=0)|(roomi-1.t1.mon<=0|roomi-1.t1.mon>12)|(roomi-1.t1.date<=0|roomi-1.t1.date>tabjroomi-1.t1.mon-1)|(roomi-1.t1.hour<0|roomi-1.t1.hour>=24)printf("nn您當(dāng)前時(shí)間輸入有誤,請按照格式重新輸入:");scanf("%d-%d-%d-%d",&roomi-1.

22、t1.year,&roomi-1.t1.mon,&roomi-1.t1.date,&roomi-1.t1.hour);j=judge_year(roomi-1.t1.year);if(roomi-1.t0.mon!=roomi-1.t1.mon)for(k=roomi-1.t0.mon+1;k<roomi-1.t1.mon;k+)day+=tabjk-1;day+=tabjroomi-1.t0.mon-1-roomi-1.t0.date+roomi-1.t1.date;elseday+=roomi-1.t1.date-roomi-1.t0.date;hr=room

23、i-1.t1.hour-roomi-1.t0.hour;if(roomi-1.flag=1) /*根據(jù)房間類型和計(jì)費(fèi)方式計(jì)算費(fèi)用*/if(hr<0)total_hour=day*24-hr;elsetotal_hour=day*24+hr;if(i<=40)price=8*total_hour;elseprice=7*total_hour;if(roomi-1.flag=2)while(hr<0)day=day-1;hr=hr+24;if(hr<8)total_day=day;elsetotal_day=day+1;if(i<=40)price=148*total

24、_day;elseprice=128*total_day;while(price<0)printf("當(dāng)前時(shí)間輸入有誤,請按照格式重新輸入:");goto shuru;printf("nn當(dāng)前費(fèi)用為:%ld元.nn",price); /*輸出當(dāng)前費(fèi)用*/choice();/*結(jié)賬退房函數(shù)*/void fee()system("cls");system("color 4E");printf("n*結(jié)賬退房*n");int i;int j;int k;int tab212=31,28,31,3

25、0,31,30,31,31,30,31,30,31,31,29,31,30,31,30,31,31,30,31,30,31; int day=0;int hr=0;int total_hour;int total_day;long int price;long int fee;printf("請輸入您的房間號:");scanf("%d",&i);while(i<1|i>80) printf("nn您的房間號輸入有誤,請您重新輸入:"); scanf("%d",&i); read(i);w

26、hile(roomi-1.flag=0) /*判斷房間是否有客人入住*/printf("nn該房間無人入住,請重新輸入您的房間號:");scanf("%d",&i);read(i);printf("nn請按所示格式輸入當(dāng)前時(shí)間(年-月-日-時(shí),時(shí)為24小時(shí)制):"); /*輸入當(dāng)前時(shí)間*/shuru:scanf("%d-%d-%d-%d",&roomi-1.t1.year,&roomi-1.t1.mon,&roomi-1.t1.date,&roomi-1.t1.hour);j

27、=judge_year(roomi-1.t1.year);while(roomi-1.t1.year<=0)|(roomi-1.t1.mon<=0|roomi-1.t1.mon>12)|(roomi-1.t1.date<=0|roomi-1.t1.date>tabjroomi-1.t1.mon-1)|(roomi-1.t1.hour<0|roomi-1.t1.hour>=24)printf("nn當(dāng)前時(shí)間輸入有誤,請按照格式重新輸入:");scanf("%d-%d-%d-%d",&roomi-1.t1.y

28、ear,&roomi-1.t1.mon,&roomi-1.t1.date,&roomi-1.t1.hour);j=judge_year(roomi-1.t1.year);if(roomi-1.t0.mon!=roomi-1.t1.mon)for(k=roomi-1.t0.mon+1;k<roomi-1.t1.mon;k+)day+=tabjk-1;day+=tabjroomi-1.t0.mon-1-roomi-1.t0.date+roomi-1.t1.date;elseday+=roomi-1.t1.date-roomi-1.t0.date;hr=roomi-1.

29、t1.hour-roomi-1.t0.hour;if(roomi-1.flag=1) /*根據(jù)房間類型和計(jì)費(fèi)方式計(jì)算費(fèi)用*/if(hr<0)total_hour=day*24-hr;elsetotal_hour=day*24+hr;if(i<=40)price=8*total_hour;elseprice=7*total_hour;if(roomi-1.flag=2)while(hr<0)day=day-1;hr=hr+24;if(hr<8)total_day=day;elsetotal_day=day+1;if(i<=40)price=148*total_day

30、;elseprice=128*total_day;while(price<0)printf("當(dāng)前時(shí)間輸入有誤,請按照格式重新輸入:");goto shuru;fee=price-roomi-1.deposit;if(fee>0) /*輸出最后的總費(fèi)用*/printf("nn扣除押金后,您另需支付費(fèi)用%ld元。",fee);else if(fee=0)printf("nn您所交納的押金恰好能夠支付您的住房費(fèi)用,您無需另行交錢。");elseprintf("nn您所交納的押金還未使用完,本賓館應(yīng)支付您余額%ld元。

31、",-fee);printf("nnn您已退房成功,感謝您的光臨,我們下次再見!nn");roomi-1.flag=0;strcpy(,c1);strcpy(roomi-1.ID,c2);roomi-1.deposit=0;roomi-1.t0.year=0;roomi-1.t0.mon=0;roomi-1.t0.date=0;roomi-1.t0.hour=0;roomi-1.t1.year=0;roomi-1.t1.mon=0;roomi-1.t1.date=0;roomi-1.t1.hour=0;save(i);choice();/*

32、信息查詢函數(shù)*/void infor()system("cls");system("color 4E");printf("n*信息查詢*n");int i;printf("請輸入您的房間號:");scanf("%d",&i);while(i<1|i>80) printf("nn您的房間號輸入有誤,請您重新輸入:"); scanf("%d",&i); read(i);while(roomi-1.flag=0) /*判斷房間是否有客

33、人入住*/ printf("nn該房間無人入住,請重新輸入您的房間號:");scanf("%d",&i);read(i);printf("nn您的信息如下:nnn"); /*輸出客人信息*/printf("姓名:");puts();printf("nn");printf("證件號碼:");puts(roomi-1.ID);printf("nn");printf("房間類型:");if(i<=40)p

34、rintf("單人間nnn");elseprintf("雙人間nnn");printf("計(jì)費(fèi)方式:");if(roomi-1.flag=1)printf("按小時(shí)計(jì)費(fèi)nnn");elseprintf("按天計(jì)費(fèi)nnn");printf("入住時(shí)間:");printf("%d年%d月%d日%d時(shí)nnn",roomi-1.t0.year,roomi-1.t0.mon,roomi-1.t0.date,roomi-1.t0.hour);printf("

35、押金數(shù)額:");printf("%ld元nn",roomi-1.deposit);choice();/*全部信息查詢*/void information() system("cls");printf("n*全部信息*n");int i;int j;int k;int year;int month;int date;int hour;int year1;int month1;int day1;int hour1;int tab212=31,28,31,30,31,30,31,31,30,31,30,31,31,29,31,30

36、,31,30,31,31,30,31,30,31;int day=0;int hr=0;int total_hour;int total_day;long int price;printf("nn請按所示格式輸入當(dāng)前時(shí)間(年-月-日-時(shí),時(shí)為24小時(shí)制):"); /*輸入當(dāng)前時(shí)間*/scanf("%d-%d-%d-%d",&year,&month,&date,&hour);j=judge_year(year);for(i=1;i<=80;i+)read(i);if(roomi-1.flag=0)printf(&quo

37、t;房間%d無人入住。n",i);if(i<=40)printf("房間類型:單人間。n");printf("單價(jià):148元/天,8元/小時(shí)。n");elseprintf("房間類型:雙人間。n");printf("單價(jià):128元/天,7元/小時(shí)。n");elseyear1=year-roomi-1.t0.year;month1=month-roomi-1.t0.mon;day1=date-roomi-1.t0.date;hour1=hour-roomi-1.t0.hour;while(hour1&

38、lt;0)day1=day1-1;hour1=hour1+24;printf("房間%d客戶信息如下:n",i);printf("姓名:");puts();printf("證件號碼:");puts(roomi-1.ID);printf("房間類型:");if(i<=40)printf("單人間n");printf("單價(jià):148元/天,8元/小時(shí)。n");elseprintf("雙人間n");printf("單價(jià):1

39、28元/天,7元/小時(shí)。n");printf("計(jì)費(fèi)方式:");if(roomi-1.flag=1)printf("按小時(shí)計(jì)費(fèi)n");elseprintf("按天計(jì)費(fèi)n");printf("入住時(shí)間:");printf("%d年%d月%d日%d時(shí)n",roomi-1.t0.year,roomi-1.t0.mon,roomi-1.t0.date,roomi-1.t0.hour);printf("已入住時(shí)間:%d年%d月%d天%d小時(shí)。n",year1,month1,d

40、ay1,hour1);printf("押金數(shù)額:");printf("%ld元",roomi-1.deposit);if(roomi-1.t0.mon!=month)for(k=roomi-1.t0.mon+1;k<month;k+)day+=tabjk-1;day+=tabjroomi-1.t0.mon-1-roomi-1.t0.date+date;elseday+=date-roomi-1.t0.date;hr=hour-roomi-1.t0.hour;if(roomi-1.flag=1) /*根據(jù)房間類型和計(jì)費(fèi)方式計(jì)算費(fèi)用*/if(hr<

41、;0)total_hour=day*24-hr;elsetotal_hour=day*24+hr;if(i<=40)price=8*total_hour;elseprice=7*total_hour;if(roomi-1.flag=2)while(hr<0)day=day-1;hr=hr+24;if(hr<8)total_day=day;elsetotal_day=day+1;if(i<=40)price=148*total_day;elseprice=128*total_day;printf("n當(dāng)前費(fèi)用為:%ld元.n",price); /*輸出當(dāng)前費(fèi)用*/day=0;hr=0; /*時(shí)間清零*/ choice();/*功能選擇函數(shù)*/void choice()printf("n*功能選擇*n");printf("ttt 1. 入住情況 n");printf("ttt 2. 登記入住 n");printf("ttt 3. 當(dāng)前費(fèi)用 n");printf("ttt 4.

溫馨提示

  • 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

提交評論