Answered step by step
Verified Expert Solution
Question
1 Approved Answer
An integer double-dimensional array called hotel is used to keep track of reservations in a hotel of 5 floors each floor having 8 rooms. The
An integer double-dimensional array called hotel is used to keep track of reservations in a hotel of 5 floors each floor having 8 rooms. The floors are numbered 1, 2, 3, 4, and 5, and the rooms are numbered 1, 2, 3... 8. Write a CH program to manage the hotel reservations by completing the following: Write a function called is Free, that takes the array hotel, the room number and the floor number, and returns true if that room on that floor is free, and false otherwise. A reserved room has a value of 1, whereas a free room has a value of 0. Write a function called reserveRoom, that takes the array hotel, the room number and the floor number, and reserves that room on that floor. Note that this function should use the function is Free to make sure the room to be reserved is free; otherwise the function should print a message saying the room is already reserved. Write a function called freeRoom, that takes the array hotel, the room number and the floor number, and frees that room on that floor. Write a function called countFree, that takes the array hotel, and returns the number of free rooms in the hotel. Write a function called showHotel, that takes the array hotel, and outputs the status of all rooms in the hotel. The output should look as follows for the hotel: R01 RO2 R03 R04 R05 R06 RO7 ROB [x] [x] [] [] [] [x] [] [] [x] [x] 11 [x] [] [] [] [x] [] [] [] [] [x] [x] [] [x] [] [] [x] [] [x] [] F5 [x] [] [x] [] [x] [x] [x] F1 F2 F3 F4 [x] Using the functions above, write a program that shows the hotel at the start (all rooms are free), then allows a user to manage the hotel through a menu (reserve, free, print, etc.)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started