SCHOOL OF COMPUTING
FACULTY OF ENGINEERING
UNIVERSITI TEKNOLOGI MALAYSIA
SEMESTER 1 2020/2021
DATA STRUCTURE & ALGORITHMS (SECJ2013)
SECTION 09
MINI PROJECT DOCUMENTATION
HOTEL BOOKING SYSTEM
GROUP MEMBER MATRIC NO
CHIAM WOOI CHIN A19EC0034
GOH JO EY A19EC0047
NG JING ER A19EC0115
ONG YIN REN A19EC0204
LECTURER: DR MOHAMAD ASHARI HAJI ALIAS
DATE: 28th JANUARY 2021
PART 1: INTRODUCTION
1.1 Synopsis Project
Our C++ mini project is the Hotel Booking System. The project is for the admin of the
hotel to manage the room and the booking details of customers and for the customer to book the
hotel room.
The type of data structures used in this system are sorting, linked list and queue. There
are several classes in this system which are customer, bill and hotel room class. The admin can
add, delete and check the availability of the hotel room with the linked list data structures which
add or delete the room to the list. The room types have single, double, premium and deluxe. The
customer can book, cancel the room and check the availability of the hotel room by updating the
linked list of rooms. They have to fill in their personal details in order to book the room. The
system updates the information of customers booking by linked list and sorts it by using the
sorting technique. The customer booking is added to the queue of pending booking. After the
customer booked the room, the admin can check the customer booking and review the booking
information. The admin needs to confirm the pending booking and provide the bill for the
customer by using queue data structure. The queue is for the pending booking to add to the bill
queue for confirmation of booking and delete the last pending booking if want to cancel.
1.2 Objective of The Project
● For admin to manage the details of hotel room, booking and customers
● To simplify the booking process of customer
PART 2: SYSTEM ANALYSIS AND DESIGN (USE CASE, FLOWCHART AND CLASS
DIAGRAM)
2.1 System Requirements
2.1.1 Use case diagram
Figure 1: Use case diagram for Hotel Booking System
2.1.2 Use Cases Description for Hotel Booking System
The system users are admin and customer.
Actor Task
Admin The admin can add, delete and check the availability of the hotel room. The
admin also can change the room price. After the customer booked the room,
the admin can check the customer booking and review the booking
information. The admin needs to confirm the pending booking and provide
the bill for the customer.
Customer The customer can book, cancel the room and check the availability of the
hotel room. They have to fill in their personal details in order to book the
room.
2.1.3 Detail Description for Each Use Cases
The system has 6 main use cases
Use Case Purpose
Update room Update information of room includes the updated room price
by adding or deleting the room.
Check room availability View the room information and availability of the room
Change room price Change and update the price of each type of room
Check customer booking View the detail list of the customer’s booking
Review and confirm pending Show all the details of the customers and the room before
booking confirm the booking
Book room Book the room and fill in their personal details by adding the
booking to the booking list.
Cancel room Make cancellation of their booking by deleting the booking
from the booking list.
2.2 System Design
FlowChart 1: Add room (Admin - Update room)
Explanation based on flowchart 1:
The data structure applied in this flowchart is insertion sort and linked list. The user is required
to enter the room number that he/she wants to add to the system. It will first check whether the
room number exists in the system or not. If the room number is unique, it will start the flow
chart. The flowchart starts with initializing room number=n, current index = 0, points the
current node to the head of the room linked list and the previous node set to NULL. The
flowchart is divided into two-part, insertion sort and add a node into the room linked list. In the
insertion sort part, it will find the correct position for the inserted node in ascending order of the
room number. The flow chart starts to point current nodes to the head of the linked list. If the
condition is true(the current node and the room number inserted by the user are greater than the
room number of the current node), the loop will continue by changing the
previousNode=currentNode, currentNode= the next of the current node and current
index=current index+1. The loop will continue until the condition is false. When the condition is
false, it will start the part to insert a node into the linked list. It starts with creating a new node.
If the current index is equal to 0, it is an empty linked list, the next of the new node is pointing
to the head(NULL) and the head is pointing to the new node. Otherwise, the next of the new
node is pointing to the next of the previous node and the next of the previous node is pointing to
the new node.
Prepared By: CHIAM WOOI CHIN & GOH JO EY
FlowChart 2: Delete room (Admin - Update room)
Data Structure: Delete node in linked
Explanation based on flowchart 2:
Delete a room from the system including two parts. First, it checks whether the room exits in the
link list. If the first condition is true, it will continue to find the node in the linked list and delete
it. For the first part, it will initialize room number as n, current node is pointing to the head of the
linked list and current index equal to 1. If the current node and the room number of the current
node is not equal to the room number entered by the user, it will continue to loop by pointing the
current node to the next of the current node and increase the current index by 1. Once the loop is
done, it will check whether the current node is Null or not. If it is null, it will return zero,
otherwise, it will return the current node. For the second part, it will use the same theory as
explained before to find the node that contains the room number entered by the user and delete
the node. After delete the node, it will prompt a message of “You successfully delete the room
number(n)”. For the fail case(cannot find the corresponding node in the linked list), the system
will prompt an error message.
Prepared By: CHIAM WOOI CHIN & GOH JO EY
FlowChart 3: Display room (Customer and Admin)
Data Structure:
Explanation based on flowchart 3:
For the function to print the room in the hotel, it will apply the data structure of display in the
linked list. The flowchart starts with initializing an integer to zero and pointing the current node
to the head of the linked list. The loop will start and continue with the condition that the current
node is not null. The loop will display the floor number, room number, room type, room price
and status availability of the room. The loop is changing the current node by pointing the current
node to the next node in the linked list and increasing the integer by 1. The loop is ended when
the condition is false(current node is null).
Prepared By: CHIAM WOOI CHIN & GOH JO EY
FlowChart 4: Change price (Admin)
Data Structure: Delete node and find node in the linked list
Explanation based on flowchart 4:
For the change in the price of the room by the admin, First, it checks whether the room exists in
the linked list. If the first condition is true, it will continue to find the node in the linked list and
change the price. For the first part, the current node is pointing to the head of the linked list and
current index equal to 1. If the current node and the room number of the current node is not
equal to the room number entered by the user, it will continue to loop by pointing the current
node to the next of the current node and increase the current index by 1. Once the loop is done,
it will check whether it is the current node or not. If it is, it will return zero, otherwise, it will
return the current node. For the second part, if the room exists, it will let the admin input the
price that wants to change. The newNode points to the result of find room which is the first part
then the price of newNode points to the input price. After that, it will display the room number
and the changed price. If the room does not exist, it will let the user enter another room number
again.
Prepared By: CHIAM WOOI CHIN & GOH JO EY
FlowChart 5: Check customer booking list (Admin)
Data Structure:
Explanation for flowchart 5:
Once the customer books a room from the system, it will create a customer linked list to store the
information of the customers with their corresponding booked room. Admin have a function of
checking the customer booking list in the system. If the customers cancel the room, the
customers records and their booked room will be deleted. The flowchart starts to initialize num
to zero and points the current node to the head. A loop will be started with a condition that the
current node is not null. Inside the loop, it will display the information in the customer node,
point the current node to the next node in the linked list, and increment num by 1. The flowchart
is ended when the condition of the loop is false and displays the total number of rooms in the
system.
Prepared By: NG JING ER & ONG YIN REN
FlowChart 6: Review and confirm pending booking (Admin)
Data Structure: Queue
Explanation based on flowchart 6:
The review and confirm pending booking involve the implementation of a queue. The flowchart
of this module is mainly about the function of deQueue() that under the class billQueue. The
deQueue() function is used to remove and change the status of the rooms in the hotel. The new
billNode is dynamically allocated and assigned to pointer temp, the, frontPtr is assigned into
location pointed to by pointer temp.First, if the frontPtr is null, it will display to the user that
there is no pending booking for review. Else if the next pointer in billNode is not null, the system
will request the user to change the status of booking. To confirm the booking, the temp will be
assigned to be the next pointer of billNode, and frontPtr will be assigned to be temp which may
result in the pending booking to be removed from the queue. Or else if the case does not match
with the above condition, the system will request the user to change the status of booking and
only the status of the booking that is “CONFIRMED” will be removed from the queue.
Prepared By: NG JING ER & ONG YIN REN
Flowchart 7: Book Room
Data Structure: linked list and queue
Explanation based on flowchart 7:
The book room implemented the linked list and queue.For the linked list implementation, first, it
checks whether the room number is exits.For the first part, it will initialize the current index
equal to 0, current node pointing to the head of linked list and previous node pointing to the
NULL of linked list. If the condition of current node and the room number are bigger than the
room number of the current node, it will continue looping by pointing previous node is equal to
the node and the current node is equal to the next of the current node and last increases the
current index by 1.For the second part, if the condition are false, the new node that reference to
the custnode is equal to the new room node. It will initialize the new node pointer to custname as
n, new node pointer to custphone as p, newnode pointer to ic are ic, newnode pointer to datein as
in, newnode pointer to dateout as out an newnode pointer to roomnum as rn.
It will continue the loop by pointing that the current index is equal to 0. If this condition are true,
it will continue looping by pointing the next of newnode equal to head and the head is equal to
the next of newnode and end the booking process.However, it will continue looping by pointing
the next of newnode is equal to the next of previous node if the condition is false.Then, it will
continue looping by pointing the next of the previous node equal newnode and end the booking
process.
For the implementation of queue, it initializes the room number as rn, price as p, ic number as ic,
number of days as days, datein as in, dateout as out, name as n and the temp reference to
billNode equal to new billNode.If the back pointer of the queue equal to NULL, it will continue
looping by pointing the temp point to next equal to NULL.Then,user needs to insert the
information of the customer into the temp node and front pointer of the queue equal to back
pointer of the queue equal to temp.It will end the process or continue regarding the choice of
user. However, if the back pointer of the queue is not equal to NULL, the next of the back
pointer in the queue equal to temp.Then, user needs to insert the information of the customer into
the temp node, the back pointer of queue equal to temp and last ended the flowchart.
Prepared By: NG JING ER & ONG YIN REN
Flowchart 8: Cancel Room
Data Structure: Delete node in linked list
Explanation based on flowchart 8:
For the cancel booking room function, it will first start the find room function and check the
room number entered by the user exits in the system and check whether the room is booked. It
will only start the flowchart above(delete the customer node in the customer linked list) if the
condition(the room exists and is booked) is true. The flowchart will initialize current index as 1
and string rn as the room number. It will point the previous node as NULL, and point the current
node to the head of the linked list. It will start a condition to find the position of the finding node
by comparing and checking the room number entered by the user. The loop will be continued by
pointing previous node to the current node, pointing the current node to the next of the current
node and increasing the current index by 1. After the loop is done it will check whether the ic
entered by the user is the same with the ic in the found node. If the condition is true, it will start
to point the current node to the next of current node(found node in middle or last of the linked
list) or point the head to the next of the current node(found node in the first of the linked list)
and delete the node. It is done with delete customer nodes in the customer linked list. Lastly, it
will change the status of the room node to “available” if the delete customer node process is
successful.
Prepared By: NG JING ER & ONG YIN REN
PART 3: SYSTEM PROTOTYPE
Below are some of the interfaces of our hotel booking system prototype. The users include
admin and customer, therefore the interfaces below will be divided based on each user.
Screen 1: Hotel Booking menu
Screen 1:The user needs to enter the integer value in the range of 1 to 3.If the user enter 1 ,
user will login as an admin, and if user enter 2 will login as a customer and if user enter 3 it will
exit the program. Otherwise, the program will prompt invalid choice and the screen will display
again after the user presses any key.
Prepared By; ONG YIN REN
Screen 2: Admin Menu
Screen 2: If the user enters integer 1 after choosing admin, it will display an admin menu.The
user needs to enter the integer value in the range of 1 to 7 according to what choices they want. If
the user enters the other number, the system will prompt invalid choice and the screen will
display again after the user presses any key.
Prepared By: ONG YIN REN
Screen 3: Admin - Adding room
Screen 3: For choice 1, if the user enters a new room number, it will display a successful
message. If the user enters an existing room number, it will display an error message and request
the user to try another room number. After that, it will display an option to have or not for
continuing the adding room process. If wanted, enter 1 else enter 0 if not interested to continue
adding. The screen of the admin menu will display again after the user presses any key.
Prepared By: CHIAM WOOI CHIN
Screen 4: Admin - Deleting room
Screen 4: For choice 2, it will allow the user to enter a room number to delete a room. If the user
enters an existing room number, it will display a successful message or else it will request the
user to enter another room number. After that, it will display an option to have or not for
continuing the deleting room process. If wanted, enter 1 else enter 0 if not interested to continue
deleting. The screen of the admin menu will display again after the user presses any key.
Prepared By: CHIAM WOOI CHIN
Screen 5: Admin - Displaying rooms in the hotel
Screen 5: For choice 3 of admin, it will display the rooms in the hotel and their status. The
details of the room in the hotel included floor, room number, room type, price and status of
availability. If the user enters any key, the system will prompt to the admin menu.
Prepared By: CHIAM WOOI CHIN
Screen 6: Admin - Change price of the rooms
Screen 6: User needs to insert a room number that wants to change price. After that, the user
needs to insert a new price for the related room number. Then, the system will display a
successful message on the screen. Users need to enter 0 or 1 to continue or not for changing the
room price.
Prepared By: NG JING ER
Screen 7: Admin - Checking booking list
Screen 7: The system will show all the booking details of the customer. Admin able to check
with the existing booking and the customer details. Users need to enter any key to continue.
Prepared By: NG JING ER
Screen 8: Admin - Reviewing and confirm booking
Screen 8: The system will show all the bookings that need to be confirmed. To change the status
of booking, the user needs to enter the integer value in the range of 0 to 2 where 0 is pending, 1
is confirmed and 2 is cancelled.
Prepared By; NG JING ER
Screen 9: Customer Menu
Screen 9: The user needs to enter the integer value in the range of 1 to 4 according to what
choices they want. If the user enters the other number, the system will prompt invalid choice and
the screen will display again after the user presses any key.
Prepared By: ONG YIN REN
Screen 10: Customer - Displaying room in the hotel
Screen 10: It will display all the rooms in the hotel. The details of the room in the hotel included
floor, room number, room type, price and status. If the user enters any key, the system will
prompt to the customer menu.
Prepared By: GOH JO EY
Screen 11: Customer - Booking a room
Screen 11: It will display a successfully booked message if the user entered the matched room
number in the hotel. After that, users need to enter their personality such as their name, phone
number, number of ic, date check in and date check out with the correct format.Then, it will
display “please proceed to the bill at the counter”. Users will then need to enter 1 or 0 to continue
or not for their booking.
Prepared By: GOH JO EY
Screen 12: Customer UNABLE cancelling the room
Screen 12: If the user enters the room that wishes to cancel is invalid, then the system will
display a record not found and unable to make cancellation. After that, the user needs to enter 1
for continuing or 0 quit the cancellation process.
Prepared By: GOH JO EY
Screen 13: Customer SUCCESSFULLY cancelling the room
Screen 13: User needs to enter the room that wishes to cancel is valid, then the system will
display successfully cancelled. After that, the user needs to enter 1 to continue or 0 to stop the
cancellation process.
Prepared By: GOH JO EY
PART 4: SYSTEM TESTING
1. Test Case Matrix for the Book Room By Customer Use Case
Scenario Roo Custome Phone No. IC Date in Date out Expected Test Result
m r Name (YYYYM (YYYYM Result
No. MDD) MDD)
1. Successfully 4401 Jane 0123456789 870821-00-0000 20201231 20210131 Successfully Successfully
Booking booked booked
message message
displayed and displayed
request for and request
continue for continue
2. Successfully 3301 WC 0129876543 990821011234 20210213 20210214 Successfully Successfully
Booking Chiam booked booked
message message
displayed and displayed
request for and request
continue for continue
3. Unidentified 1000 N/A N/A N/A N/A N/A Error message Wrong room
room displayed and number
number request for
continue
2. Test Case Matrix for the Cancel Room By Customer Use Case
Scenario Room No. IC Expected Result Test Result
(xxxxxx-xx-xxxx)
1. Successfully 1101 870821-00-0000 Booking room is Booking room with
cancelling the successfully room number under
room cancelled customer with IC has
been deleted.
2. Unidentified room 1234 N/A Error messages and Error: Record cannot
number back to customer be found
menu unable to make
cancellation
3. Unidentified IC 1101 123456 Error messages and Error: Record cannot
back to customer be found
menu unable to make
cancellation
3. Test Case Matrix for the Update Room By Admin Use Case
Scenario Room No. Expected Result Test Result
1. Successfully add a 1108 Successfully added Successfully added message
new room message displayed and displayed and request for
request for continue continue
Adding an existing 1101 Error message displayed Error: The room exists.
room and request for continue
2. Successfully delete a 1101 Successfully added Successfully deleted message
room message displayed and displayed and request for
request for continue continue
3. Unidentified room 5501 Error message displayed Error: The room number cannot
number to be delete and request for continue be found
4. Test Case Matrix for the Change Room Price By Admin Use Case
Scenario Room Price (RM) Expected Result Test Result
No.
1. Successfully changed 1101 100 Successfully changed Successfully changed
a room price message displayed and message displayed
request for continue and request for
continue
2. Unidentified room 5501 400 Error message Error: The room
number displayed and request number cannot be
for continue found
5. Test Case Matrix for the Check Room Availability Use Case
Scenario Expected Result Test Result
1. Successfully checked room Floor number, room number, Floor number, room number,
availability room type, room price and room type, room price and room
room availability are displayed. availability are displayed.
6. Test Case Matrix for the Check Customer Booking Use Case
Scenario Expected Result Test Result
1. Successfully checked Customer name, room no., Customer name, room no., phone
customer booking list phone no., IC, date in, date out no., IC, date in, date out and
and number of rooms are number of rooms are displayed.
displayed.
2. No customer book the room No record of customer booking No record of customer booking
list list
7. Test Case Matrix for the Review and Confirm Pending Booking By Admin Use Case
Scenario Status Expected Result Test Result
1. Review and confirm 1 Customer name, IC, booking Customer name, IC, booking
the pending booking room no., date check in, date room no., date check in, date
(0- PENDING check out, number of days, room check out, number of days,
1- CONFIRMED price per night and total room room price per night and total
2- CANCELLED) price are displayed. room price are displayed.
The status of room availability The status of room availability
changed. changed.
2. No pending booking N/A No record of customer booking No record of customer
information booking information
PART 5: DEVELOPMENT ACTIVITIES
Meeting Members Activity Task for each member Task
Date Participate in the Achieved
meeting (yes/No)
05/01/2021 1. Chiam Wooi Discuss the title, All members do the research for 1. Yes
Chin objective and the hotel booking system related 2. Yes
2. Goh Jo Ey concepts of the and the implementation of data 3. Yes
3. Ng Jing Er system. structure in the system. 4. Yes
4. Ong Yin Ren
08/01/2021 1. Chiam Wooi Discuss the 1. System Design (flowchart 1-4) 1. Yes
Chin system analysis, 2. System Design (flowchart 1-4) 2. Yes
2. Goh Jo Ey system 3. System Design (flowchart 5-8) 3. Yes
3. Ng Jing Er requirement, use 4. System Design (flowchart 5-8) 4. Yes
4. Ong Yin Ren case and system
design.
13/01/2021 1. Chiam Wooi Do the system 1. Admin choice 1,2,3 1. Yes
Chin design by 2. Customer choice 1,2 2. Yes
2. Goh Jo Ey programming 3. Admin choice 4,5,6 3. Yes
3. Ng Jing Er using C++ and 4. Customer choice, complete 4. Yes
4. Ong Yin Ren complete report. report
16/01/2021 1. Chiam Wooi Discuss and All members improve source 1. Yes
- Chin improve the code, complete report and 2. Yes
28/01/2021 2. Goh Jo Ey system design prepare for presentation video 3. Yes
3. Ng Jing Er and C++ coding 4. Yes
4. Ong Yin Ren and complete
report.
PART 6 : APPENDIX HARDCOPY OF SOURCE CODE
APPENDIX V: PEER REVIEW ASSESSMENT
Name: Chiam Wooi Chin A19EC0034
Team member Cooperative Hardworking Punctuality Knowledge Good
name: (1-min, 5-max) (1-min, 5-max) (1-min, 5-max) Sharing personality
(1-min, 5-max) (1-min, 5-max)
Goh Jo Ey 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5
Ng Jing Er 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5
Ong Yin Ren 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5
TOTAL 15 15 15 15 15
Name: Goh Jo Ey A19EC0047
Team member Cooperative Hardworking Punctuality Knowledge Good
name: (1-min, 5-max) (1-min, 5-max) (1-min, 5-max) Sharing personality
(1-min, 5-max) (1-min, 5-max)
Chiam Wooi Chin 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5
Ng Jing Er 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5
Ong Yin Ren 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5
TOTAL 15 15 15 15 15
Name: Ng Jing Er A19EC0115
Team member Cooperative Hardworking Punctuality Knowledge Good
name: (1-min, 5-max) (1-min, 5-max) (1-min, 5-max) Sharing personality
(1-min, 5-max) (1-min, 5-max)
Goh Jo Ey 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5
Chiam Wooi Chin 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5
Ong Yin Ren 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5
TOTAL 15 15 15 15 15
Name: Ong Yin Ren A19EC0204
Team member Cooperative Hardworking Punctuality Knowledge Good
name: (1-min, 5-max) (1-min, 5-max) (1-min, 5-max) Sharing personality
(1-min, 5-max) (1-min, 5-max)
Goh Jo Ey 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5
Ng Jing Er 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5
Chiam Wooi Chin 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5
TOTAL 15 15 15 15 15