Design and Implementation of a C++Based Hotel Management System

: In this paper, we use C++ as the development language and QT to design and develop a hotel management system for the current development of the hotel industry. The system adopts the B/S model to connect the object with the database, so that it has better flexibility and reusability. Its functional modules mainly include customer service module, front-end processing module, back-end management module, data storage module and other parts, which mainly realize the hotel customer's reservation, check-in and check-out and the management of the hotel internal staff and other functions. The development cost of the system is low and the operation is simple, which reduces the learning cost of the staff, improves the management efficiency of the hotel and facilitates the maintenance and management at a later stage


Introduction
With the development of the times, the application of computers in hotel management has been extended to various departments, and the hotel management system has become an important tool for modern hotel management. Through the computer system to deal with things in the hotel, it has solved the drawbacks of manual management, reduced labor costs and time costs, and improved management efficiency. At present, part of the hotel management system is still C/S architecture, each terminal needs a client, [1] resulting in low processing efficiency, equipment maintenance trouble, increasing the user's difficulty of use. In this paper, we design and adopt a hotel management system based on B/S architecture, which can effectively manage the information of the hotel, reduce the maintenance cost of the hotel, and then improve the profitability of the hotel and increase the overall competitiveness of the hotel. The system development uses MySQL database for data storage, MySQL++ as API for linking, and Microsoft Visual Studio 2019 combined with QT for windows side development.

System Requirements Analysis
The design of the C++-based hotel management system is oriented to the hotel's internal staff and the hotel's customers. In order to facilitate the use of users, the system should be designed to be relatively simple, easy to understand operation, and reduce the learning cost of staff and customers in order to achieve high efficiency. The system needs to realize the internal management of the hotel and the customer-oriented part respectively, and the hotel's staff information and customer information are not interchangeable. In the client side, the main functions of the system include room reservation, check-in service, departure settlement, etc. In the staff side, the main functions of the system include work arrangement, authority management, staff application, etc. After the system design is completed, daily maintenance personnel need to be retained to ensure the normal operation of the system.

System Function Analysis
The system will be mainly divided into two parts, one for customers and one for hotel staff. The customer-oriented part mainly realizes the functions of hotel information view, room reservation, information registration, room service, departure settlement, hotel contact and hotel evaluation, etc.; the hotel staff-oriented part mainly realizes the functions of staff information registration, work arrangement, staff application, etc.
After logging into the system, customers can view and book the hotel. The hotel information module contains the basic information of the hotel, so that customers can see the location, appearance, contact phone number, user evaluation and other basic information of the hotel on the cell phone; the room reservation module allows customers to see the specific information of the room, including the room type, size, lighting condition, location and other information, and at the same time, they can book the room type they want, and subsequently they can also unsubscribe from the rooms already booked; the information Registration module is the basic information that customers need to fill in when booking a room, including customer name, ID number, contact information, length of stay, arrival time, number of people staying, etc., so that it is convenient to confirm with the front desk when arriving at the hotel; room service module is the service that customers can choose after staying at the hotel, this module contains the relevant services in the room, such as TV screen casting, breakfast delivery, take-away, etc. Services, through the choice can be made to the hotel service personnel for service; departure settlement module allows customers to leave the hotel at anytime, anywhere, without waiting for the hotel settlement, refund deposits and other operations can be achieved directly under this function, saving time; contact the hotel and evaluation of the hotel module means that users can contact the hotel before and after the stay for consultation, to understand the relevant information, or after leaving the hotel are to the hotel's service and environment, etc. for evaluation.
After the employee's log in the system, they need to use different functions according to different authority. The information registration module of hotel staff needs to register the staff's name, age, work number, ID number, origin, position and system authority, etc. All hotel staff need to be registered. Ordinary employees can check their current schedule, sign in and clock out, and make applications to the management, etc. The employee application function is mainly used for employees' leave and shift transfer applications. Front desk staff can register and confirm customers' information at check-in, give feedback to customers' room reservation, help call service staff or maintenance staff, check and update hotel room information, respond to customers' service requests after check-in, and help settle accounts after customers leave the hotel, record customers' opinions and comments, etc. according to the rights assigned by the administrator. Managers such as the hotel manager can check the basic information of employees, review the application of employees, check the operation of the hotel, make work arrangement for other employees, review the financial situation, check the customer information, modify the room information, check the evaluation of the hotel by the customers who have stayed in the hotel, etc. after logging into the system. If an employee takes a leave of absence, other employees can be drawn to fill the missing position in time, and at the same time, some relevant information about special offers can be released. The system administrator has all the rights of the system, but can only use it after getting the authorization from the hotel management, and is only responsible for maintaining the normal operation of the system on a daily basis.

Design of Classes
C++ is an object-oriented programming language, and classes are a very important concept in C++, which is the basis for implementing object-oriented programming. A C++ program of a certain size is made up of many classes. In the process of writing class definition, functions and variables should be named according to their meanings and functions, not just any names. According to the top-down programming principles, the class definitions are written according to the plan. The following is the design of the specific relevant classes in the program. [2] The hotel management system as a whole needs the following classes, permission class includes customer class, administrator class, front desk staff class and general staff class, permission class is mainly through different permissions to distinguish between staff and customers, as well as the functions between various employees; information class includes room information, customer information, staff information, hotel information, etc., which is mainly used to store relevant information, combined with the previous permission class, so that people with different permissions can access different information. The staff class is the base class, the administrator class inherits all its permissions, while controlling other permission classes, has the right to manage and control them, modify other staff permissions, can read and modify all the information in the information class of the information, which, the system administrator generally uses its own permissions, which is mainly responsible for the daily maintenance of the system. The front desk staff class contains the general staff class, which can notify the users when they need it, so that the staff of corresponding functions can meet the needs of customers, such as daily cleaning and maintenance work, while the front desk can view the corresponding customer information, room information, and can modify this information. The general staff class mainly completes the work arrangement from the manager, and can also make application to the manager. The database is the data support for the system and the data that comes into the system is put into the database for storage. By analyzing the above E-R diagram, the system requirements for the database can be derived, and the logical structure of the database can be further determined, and the logical structure model of the database can be further determined from the above E-R diagram, [3] to derive the database information tables required by the system, mainly including customer information table, staff information table,  room information table, hotel information table,  Customer information table includes: name, contact information, document type, document number, room number, length of stay, stay time, comments and other parts. Customer name is generally 2-4 Chinese characters, using varchar type, a Chinese character needs three bytes, so set its length to 12; contact information is generally 11 digits cell phone number, so set it to the length of 11 varchar type; document type is Chinese characters, there are a variety of types, so set it to the length of 128 varchar type; document number is generally The ID number is usually 18 Arabic digits, so set it as a varchar of length 18; the length of stay is from a certain day to a certain day, so its data type is datetime; the check-in time refers to a certain day and a certain time when the customer checks in, so its type is datetime; the note refers to the note information left by the customer when booking the room, so set it as a varchar of length 128; The user priority is decided according to the customer's consumption in the hotel, and its data type is set to int with a length of 5, which is used to identify whether the customer can enjoy priority service and personalized service. Other information tables are designed in the same way. [4] After analyzing the ER relationship diagram, the basic structure of the database tables can be constructed, and three main tables are selected in this section for structural design demonstration.

Account Function Design Implementation
After entering the system interface, the system will provide a login entrance, the system adopts a unified login interface, the user can choose to login or register after entering the login interface, follow the corresponding button prompts to complete the login operation, after entering the account password, the system will verify, if correct, then enter the operation interface, if wrong, there will be a "username or password error " prompt. Both employees and hotel customers have to log in from the same interface, but you can choose whether to log in as a customer or an employee through different options, and you will enter different operation interfaces after logging in with different identities. The customer interface allows you to choose to view information about the hotel and to make room reservations, while the employee login allows you to choose to view the current work schedule, make requests and other operations.

Implementation of Scheduled Functions
After logging into the system, customers can use the room reservation function through the navigation bar of the system. After selecting the corresponding room in the interface, input the corresponding information according to the prompt of the system, such as the expected time of stay, the number of days of stay, the number of people staying, the reservation information, contact information, room information, etc. The system will generate the order after the customer fills in the relevant information, and if there is key information not filled in, then the system will prompt the customer and help him/her to improve the information. After the user confirms that the information is correct and clicks to submit the order, the reservation of the hotel room will be completed, and then the system will send the relevant order information and customer information to the relevant personnel of the hotel for review and confirmation. After the hotel completes the confirmation and ensures that the room is successfully reserved, feedback information will be sent back to the customer through the system for secondary confirmation, thus completing the entire booking process. After the reservation is completed, the customer can check the relevant order information in the personal center, make changes to the relevant information, or cancel the outstanding order.

Implementation of Front-end Functional Modules
The front desk function module can realize the functions of customer information registration, verification, room reservation, remote reception and self-service departure settlement through the Internet, in addition to updating the status of hotel rooms, reporting maintenance, and summarizing related reports. After a customer has made a reservation, the front desk of the hotel needs to respond by confirming the current status of the reserved room, reserving the room, generating a report, and providing feedback to the customer. [5] After helping the customer to complete the reservation, the relevant information is stored in the system so that the management can view it. When a customer books a room, the front desk staff can see the customer's priority level and provide priority service or better personalized service according to the customer's level to improve the customer's stay experience.

Implementation of Backend Functional Modules
The back-end part of the system is mainly provided for the hotel staff to use, which is divided into general staff, front desk administrator, system administrator and hotel management, distinguished according to the different positions and permissions. In order to simplify the design of the system, all employees use a unified operation interface, but since each employee has different permissions, different navigation bars are set up according to different permissions, so that employees with different permissions can complete their corresponding work. The part of ordinary employees mainly realizes the operations of viewing and modifying their own information, viewing the current work arrangement, making applications to their superiors, submitting customer feedback, etc. The administrator can use all the functions in the system, to process, check and approve the financial related information, manage the users of the system, view and reply to the customer's comments, approve the applications submitted by the employees, and complete the management of the rooms, including modifying the information of the rooms and setting the corresponding special offers. The system administrator has the highest authority of the system and can change the authority of other accounts, which is mainly responsible for the daily maintenance of the system, so the administrator authority is generally not used.

System Functionality Testing
After completing the design of the hotel management system, it is necessary to conduct corresponding functional and performance tests on the system. These include system interaction test, stability test, corresponding ability test and security test, etc. The relevant tests all need to simulate the operation of front desk staff, administrators, customers and other personnel. During the test, it was found that there were some conflicts in the authority of some classes and the authority was not clear enough, after which the problem was solved by redefining the classes and solving the conflicts between some statements. From the overall test results, the system's functionality and related performance could meet the expected requirements and no further problems occurred.

Conclusion
The article completed the development of the chain hotel management system based on C++ in windows environment, combined with the practical work, the design and development of the hotel management system was explored, the basic functional requirements of the hotel management system was explored, the customer service module, front-end processing module, back-end management module, data storage module and several other parts were designed and implemented, the specific development practice of the main functional modules was carried out, and the testing work of the relevant functional modules was completed, the results showed that the functions in the system run stably, the operation is relatively simple, the efficiency of the hotel management system was improved, and it has a strong practical role.