宾馆客房管理系统设计说明书.doc_第1页
宾馆客房管理系统设计说明书.doc_第2页
宾馆客房管理系统设计说明书.doc_第3页
宾馆客房管理系统设计说明书.doc_第4页
宾馆客房管理系统设计说明书.doc_第5页
已阅读5页,还剩34页未读, 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1 实践教学实践教学 兰州理工大学兰州理工大学 计算机与通信学院 2011 年秋季学期 面向对象课程设计面向对象课程设计 题 目 宾馆客房管理系统 专业班级 计算机科学与技术 4 班 姓 名 杜思远 学 号 10240401 指导教师 朱红蕾 成 绩 2 目目 录录 中文摘要 3 3 序 言 4 4 1 采用类 C 语言定义相关数据类型 5 5 2 各模块流程图及伪码算法 6 6 3 函数的调用关系图 1 10 4 调试分析 1 1 A 调试中遇到的问题及对问题的解决方法 1212 B 算法的时间复杂度和空间复杂度 1 13 3 5 测试结果 1 14 4 设计总结 1 16 6 参考文献 1 17 7 致 谢 1 18 8 3 摘摘 要要 该论文分别对软件的需求进行分析 对软件的概要设计和软件的详细设计 进行阐述 以及对软件的组装及测试的详细叙述 并附加了软件的使用说明书 操作手册 程序设计将每个功能分别编译实现 再通过函数包含 调用等方 法实现各项功能间的连接为设计思想 并采用将学生当作一个整体 整体类型 为结构体 结构体中的域表示学生的属性的这种定义结构作为数据结构 软件 将各个模块的功能分为列菜单 表明结构体 录入 排序 查询 插入及读取 等来组成整个程序 实现对宾馆客房的系统管理 该程序界面友好 易于操作 使操作者和使用者应用更加方便 关键字 关键字 C 结构体 软件 4 序序 言言 随着我国经济的迅速发展 人们的生活水平有了显著的提高 假日经济和 旅游经济已成为人们消费的热点 各地也把旅游业当作本地经济发展的重要经 济支柱之要求越来越高 宾馆酒店业的竞争也愈来愈激烈 如何在激烈的竞争 中生从发展 是每一个宾馆酒店必须面临的问题 对宾馆的经营善起决定作用 的是宾馆酒店的服务管理水平面 如何利用先进的管理手段 提高宾馆的管理 水平 以成为宾馆酒店发展的当务之急 面对住处时代的机遇和挑战 利用科 技手段提高企业管理水平是企业管理无疑是一条行之有效的途径 虽然计算机 管理并不是宾馆管理走向成功的关键元索 但它可以最大限度地发挥准确 快 捷 高效等作用 对宾馆的服务管理提供强有力的支持 因此 采用全新的计 算机网络和宾馆管理系统 已成为提高宾馆的管理效率 改善服务的水准备的 重要手段之一 在某种意义上 宾馆客房管理方面的信息话已成为现代化宾馆 的重要标志 是国家发展必要的软件管理 该程序采用的是结构体类型来所有基本信息 如下所述 包含的库函数有 include include define max1 80 define max2 10 define max3 19 包含的结构体 typedef struct Room datatype number datatype dank datatype state datatype price typedef struct Room room max1 包含的类 typedef class Customer public Customer void set name char n strcpy name n void set ID char p strcpy ID p void set room number int n room number n void set day int d day d 5 void set prepaid int p prepaid p datatype get name return name datatype get ID return ID datatype get room number return room number datatype get day return day datatype get prepaid return prepaid virtual Customer private datatype name max2 ID max3 datatype room number datatype prepaid datatype change datatype day 2 2 各模块流程图及伪码算法 各模块流程图及伪码算法 2 12 1 订房功能订房功能 a a 流程图流程图 构造一个新的顾客对象 Customer 对象 顾客的名字和身份证号及预定天数 取得该顾客要求预定房间的等级 1 单人间 2 双人间 3 标准间 4 总统套房 根据等级到相应等级的房间中查找一个既没有 被预定也没有被入住的房间 state 0 设置用户对象的房间号属性并设置该房间的状 态为已被预定状态 state 1 将顾客数加 1 6 b b 伪码算法伪码算法 void book room customer i new Customer 分配空间 int room standard day cout 请您选择预定房间的标准 n cout room standard cout day customer i set day day switch room standard 根据房间的标准运用根据房间的标准运用 case 语句表示其一等 两等 语句表示其一等 两等 三等 四等 三等 四等 int n cout 住房费用总共为 day 150 200 300 600 元 n for n 60 n 80 n if room n state 0 cout 预定成功 房间号码为 room n number set room number room n number break break i 住房的顾客数加 1 7 2 22 2 入住登记功能入住登记功能 a a 流程图流程图 顾客订房了 是 否 输入顾客姓名和身份证 查询该记 录 取得该顾客的住房编号 取得该顾客的预定住房天数 并根 据住房编号计算住房费用 收费 设置该顾客的住房费 修改 该住房为已入住状态 state 2 构造一个新的顾客对象 设 置住房天数和住房标准 根据该住房标准查询到一个空的房间 然后设置该顾客的住房编号 房间状态 为已入住状态 state 2 同时收取住房 费 顾客数加 1 b b 伪码算法伪码算法 void check in char name1 max2 id1 max3 int ding or no prepaid cout 订了 2 没订 定了 则输入其姓名和身份证定了 则输入其姓名和身份证 号 号 for int j 0 jget name name1 0 取得定房的房间号 cout 顾客 name1 今天入住本宾馆 房间号码为 num get day 150 customer j set prepaid prepaid cout 请收房费 prepaid 元整 set prepaid prepaid cout 请收房费 prepaid 元整 n for n 0 20 40 60 n 20 40 60 80 n if room n state 0 cout 入住房间号码为 room n number set room number room n number break i 顾客数加 1 2 32 3 退房结算功能退房结算功能 9 a a 流程图流程图 退房 否 否 是 输入客户姓名和身份证号 获取该客户实际入住天数 获取客户的实际费用 预交费用是否够支 付 退还余款退房完成 入住客户数减 1 补齐欠款 账目核算完毕 b b 伪码算法伪码算法 void check out char name2 max2 id2 max3 int standard j room number day1 day2 day cout name2 id2 cout day2 for j 0 jget name name2 0 standard room number 100 day1 customer j get day day day1 day2 switch standard 根据 根据 standard room number 100 输出顾客的房间号和费用 在看是否超 输出顾客的房间号和费用 在看是否超 10 出预订天数 定下顾客是多住还是提前走 确定其最后的费用 出预订天数 定下顾客是多住还是提前走 确定其最后的费用 case standard cout 顾客的房间号是 room number 为单人间 双人间 标准间 总统套房 每天 150 200 300 600 元 n cout 该顾客预付了房费 get prepaid 元 实际消费 day2 150 200 300 600 0 cout 请退给该顾客 day 150 200 300 600 元整 n if day 0 cout 请补收该顾客住房费 day 150 200 300 600 元整 n break cout account if account 1 for int k 0 kget room number room k state 0 i for j i j customer j customer j 1 delete customer i 11 2 4 信息查询功能信息查询功能 a a 流程图流程图 询 查 息 信 询 查 容 内 择 选 进入客户信息查询进入房间信息查询 获取客户相关信息 获取客房预定 入 住和空余信息 显示预定 入住和空 房对应的房号 按姓名查询按身份证号查 询 输入客户姓名输入身份证号 显示客户相关信息 查完退出查询 b b 伪码算法伪码算法 void inquire char inquire choice cout 房间信息查询请按 1 顾客信息查询请按 2 inquire choice if inquire choice 1 int j k 0 cout 下列房间还没人预订 也没人入住 endl for j 0 j 80 j if room j state 0 if k 10 0 cout endl cout room j number t k 12 房间增加 k 0 cout 下列房间已预订 endl for j 0 j 80 j if room j state 1 if k 10 0 cout endl cout room j number t k 房间增 加 k 0 cout 下列房间有人入住 endl for j 0 j 80 j if room j state 2 if k 10 0 cout endl cout room j number t k 房间 增加 else if inquire choice 2 cout 按姓名查询请按 1 按身份证查询请按 2 inquire choice if inquire choice 1 2 看程序是按顾客姓名 看程序是按顾客姓名 1 还是身份证号 还是身份证号 2 根据根据 情况查询情况查询 char name3 10 id3 19 cout 请输入顾客的姓名 请输入顾客的身份证号 name3 id3 for int j 0 jget name get ID name3 id3 0 cout name3 id3 的住房信息如下 n cout t 房间号为 get room number endl cout t 预付房费为 get prepaid endl 3 3 函数的调用关系图 函数的调用关系图 包含的函数有 Main 主函数 13 Initial room 房间信息函数 Welcome 欢迎函数 Enter 进入系统函数 Book room 定房函数 Check in 入住客房函数 Check out 退房函数 Inquire 信息查询函数 函数调用 主函数 登陆系统 房间初始化 进入该系统 定 房 入 住 退 房 信 息 查 询 4 4 调试分析调试分析 a 调试中遇到的问题以及对问题的解决办法 在存放房间信息时遇到了一些问题 房间包含的信息较多 在老师的帮助 下 我采用了结构体数组 struct Room roon 解决了这个问题 顾客信息较复杂 我采用了类 并利用了构造函数 成员函数 析构函数 虚函数 来解决 b 时间复杂度 函数名函数名时间复杂度 Book room O n Check in O n Check out O n Inquire O n 14 5 5 测试结果测试结果 5 1 进入系统和订房进入系统和订房 5 2 入住入住 15 5 3 退房退房 5 4 查询查询 16 设设 计计 总总 结结 通过三星期的面向对象课程设计的学习 我运用 C 语言设计 我从中受 益匪浅 并且对 C 语言程序设计这两门课程有了更深一步的认识 在实习中 我可以把这学期所学的理论知识和实践联系起来 在所要开发的项目中渐渐成 长 虽然我对 C 语言知识运用得还不是很熟练 但是相信我也在滴水穿石地 成长起来 发现问题 提出问题 解决问题 使我从不足之处出发 寻找新的 学习方向 在实习中 我设计了一组对宾馆客房进行管理的系统 它基本满足了界面 友好 易于操作的要求 因此更利于用户操作方便 运行简易 从而达到对宾 馆客房更加有效系统的管理 并且速度更快内容更直接地达到用户所想要的效 果 我一边实习一边探索 发现理论和实践要充分地结合 是需要扎实的基本 功的 这就表明学好基础知识是理论付诸实践的前提 在实习中我学到了很多 希望在以后我们能充分利用实习的机会充实自己 并希望这样的机会能被更好 更多地提供 17 参考文献参考文献 1 1 江明德江明德 面向对象程序设计面向对象程序设计 电子工业出版社 电子工业出版社 1993 1993 2 2 吕凤翥 语言程序设计 电子工业出版社 吕凤翥 语言程序设计 电子工业出版社 20012001 3 3 阎龙阎龙 C C 程序员的程序员的 C C 指南指南 北京航空航天大学出版社 北京航空航天大学出版社 19921992 4 4 张永张永 算法与数据结构算法与数据结构 国防工业出版社 国防工业出版社 2008 82008 8 5 5 严蔚敏 吴伟民严蔚敏 吴伟民 数据结构数据结构 清华大学出版社 清华大学出版社 2006 102006 10 18 致致 谢谢 经过这三周的实习 我们获得了许多在课堂上听课而不能获得的知识 首 先我们要感谢学校给我们安排的这次的算法与数据结构程序设计实习 然后我 要感谢朱红蕾老师对我热心的指导和帮助 是她教会了我们怎样解决问题的方 法 这样我的软件设计才会更加顺利地进行 并且充分掌握了设计程序的方法 我们还要感谢许多同学的帮助 他们的帮助对于我们来说也是必不可少的 总之 是有了他们的帮助 我们才能顺利地完成软件设计 在这里我们要 向他们说一句 非常感谢 你们辛苦了 19 附录 源代码 include using namespace std include define BUFSIZE 50 class cGuestroom void FindTheGuestroom 查找客房 void FindTheGuestroomById 按照编号找客房 void FindTheGuestroomByType 按照类型找客房 void FindTheGuestroomByPrice 按照价格找客房 void DeleteTheGuestroom 删除客房 void AddTheGuestroom 客房添加 void ModifyTheGuestroom 修改客房 template template 模板 样板 class cNode 节点 public T data cNode next template class tList public 定义成员函数 tList 20 void Create 创建链表 bool Empty const 判断链表是否为空 void Insert const T e 从尾部插入一个元素 cNode GetcNode int i 返回第 i 个节点 bool Find const T e 在链表中查找某个值 tList 销毁链表 析构 cNode head 头节点 template tList tList 类的成员函数的实现 head new cNode head next NULL template void tList Create cNode p p head p next NULL template bool tList Empty const return head next NULL 21 template void tList Insert const T e insert 插入 cNode p q p head q new cNode q data e while p next p p next p next q q next NULL template cNode tList GetcNode int i 返回第 i 个节点 int k 0 cNode p p head while p k return p 22 template bool tList Find const T e 在链表中查找某个值 bool flag false cNode p p head next while p if p data e flag true break p p next return flag template tList tList cNode p while head p head next delete head head p 23 class cGuestroom public char ID BUFSIZE 客房编号 char Type BUFSIZE 客房类型 char Book BUFSIZE 提前定房日期 char Price BUFSIZE 客房价格 char Function BUFSIZE 客房主要内容 int StayTime 入住天数有效期 bool flag 标志 cGuestroom 构造函数初始化 memset ID 0 BUFSIZE memset Type 0 BUFSIZE memset Book 0 BUFSIZE memset Function 0 BUFSIZE memset Price 0 BUFSIZE StayTime 0 0 flag false memset 把 char 类型转换成 ASCII 值 void ReadData tList tListGue 读取数据库 char buf BUFSIZE ifstream ifile Guestroom txt ios base in 创建一个输出文件流对象 if ifile 24 cerr 读取时打开文件出错 Insert Guestroom cout 读取数据成功 n n ifile close 关闭文件 return void AddtheGuestroom tList tListGue 输入客房函数 cGuestroom tempGuestroom 定义临时客房 cout 下面开始添加客房信息 n cout tempGuestroom ID 读入客房编号 cout tempGuestroom Type 读入客房类型 cout tempGuestroom Book 读入定房日期 cout tempGuestroom Price 读入价格 cout tempGuestroom Function 读入主要内容 cout tempGuestroom StayTime 读入入住有效期 tempGuestroom flag true tListGue Insert tempGuestroom 26 cout 添加成功 n system pause pause 停顿 终止 system cls void SaveData tList tListGue 保存数据 int i 0 ofstream ofile Guestroom txt ios base out 创建一个输入文件流对象 if ofile cerr 保存时打开文件出错 endl cNode p p tListGue head next while p 从内存中读取 数据 存到外盘 if p data flag ofile n ofile data ID n ofile data Type n ofile data Book n ofile data Price n ofile data Function n ofile data StayTime next cout 保存数据成功 n ofile close system pause system cls return void ModifytheGuestroom tList tListGue 修改客房信息 char id BUFSIZE cout id 读取客房编 号 bool flag false cNode p p tListGue head next while p if strcmp p data ID id 0 break p p next 28 if flag true 显示屏幕 cout 找到了 该客房的原始信息是 n cout n n 客房编号 data ID t 客房类型 data Type n t t 定房日期 data Book n t t 价格 data Price cout n t t 客房的主要内容 data Function n t t 入住有 效期 data StayTime cout n 下面开始修改该客房的信息 n cGuestroom tempGuestroom 定义临时客房 cout tempGuestroom ID 读入客房编号 cout tempGuestroom Type 读入客房类型 cout tempGuestroom Book 读入定房日期 cout tempGuestroom Price 读入价格 cout tempGuestroom Function 读入客房的主要内容 cout tempGuestroom StayTime 读入入住有效期 tempGuestroom flag true p data tempGuestroom cout 修改成功 cout endl system pause system cls return 29 void DeletetheGuestroom tList tListGue 删除客房信息 char id BUFSIZE cout id 读取客房编号 bool flag false int count 0 cNode p p tListGue head next while p if strcmp p data ID id 0 flag true break p p next if flag false cout 对不起 你所查找的客房延长了住房日期 n 如果不能删 else 如果能删 count cout 找到了 该客房的原始信息是 n 30 cout n n 客房编号 data ID t 客房类型 data Type n t t 定房日期 data Book n t t 价格 data Price cout n t t 客房的主要内容 data Function n t t 入住有 效期 data StayTime cout data flag false cout 该客房的信息删除成功 n cout endl system pause system cls return void FindtheremainGuestroomById tList tListGue 根据客房 编号查找 char id BUFSIZE cout id 读取 客房编号 bool flag false cNode p p tListGue head next while p if strcmp p data ID id 0 break p p next if flag false cout 对不起 没有该标号的客房 n 如果 找不到 else 如果找到了 cout n 找到了 该客房的信息是 n cout n n 客房编号 data ID t 客房类型 data Type n t t 定房日期 data Book n t t 价格 data Price cout n t t 主要内容 data Function n t t 入住有效期 data StayTime cout endl system pause system cls 清屏 return void FindtheremainGuestroomByType tList tListGue 根据客 房类型查找客房 char type BUFSIZE cout type 读 取客房类型 bool flag false cNode p p tListGue head next while p if strcmp p data Type type 0 break p p next if flag false cout 对不起 没有该类型的客房 n 如 果满了 else 如 果找到了 cout n 找到了 该客房信息是 n cout n n 客房编号 data ID t 客房类型 data Type n t t 定房日期 data Book n t t 价格 data Price cout n t t 客房的主要内容 data Function n t t 入住有 效期 data StayTime cout endl system pause system cls return 33 void FindtheremainGuestroomByPrice tList tListGue 根据价 格查找客房 char price BUFSIZE cout price 读取价格 bool flag false cNode p p tListGue head next while p if strcmp p data Price price 0 cout n n 客房编号 data ID t 客房类型 data Type n t t 定房日期 data Book n t t 价格 data Price cout n t t 客房的主要内容 data Function n t t 入住有 效期 data StayTime p p next if flag false cout 对不起 没有你所要求价格的客房 n 如果找不到 cout endl 34 system pause system cls return void FindtheremainGuestroom tList tListGue 查找客房 system cls while 1 cout n n n n cout 1 按客房编号查询 n n cout 2 按客房类型查询 n n cout 3 按价格查询 n n cout 4 退出查询 n n cout choose switch choose 根据 用户选择 case 1 FindtheremainGuestroomById tListGue 按客房编号 查询 break case 2 FindtheremainGuestroomByType tListGue 按客房类型 查询 break case 3 FindtheremainGuestroomByPrice tListGue 按价格查询 break 35 case 4 system cls return 退 出查询 default break return void RanktheremainGuestroom tList tListGue 排序剩余客 房 cNode p q cGuestroom remainGuestroom for p tListGue head next p NULL p p next for q p q NULL q q next if p data StayTime q data StayTime remainGuestroom flag p data flag strcpy remainGuestroom ID p data ID 复制 strcpy remainGuestroom Type p data Type strcpy remainGuestroom Book p data Book strcpy remainGuestroom Price p data Price strcpy remainGuestroom Function p data Function remainGuestroom StayTime p data StayTime p data flag

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论