An integer double-dimensional array called hotel is used to keep track of reservations in an 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 C++ program to manage the hotel reservations by completing the following:  Write a function called isFree, 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 isFree 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 R02 R03 R04 R05 R06 R07 R08 F1 [x]     [x]    [ ]    [ ]     [ ]     [x]    [ ]    [ ] F2 [ ]      [x]    [x]   [ ]     [x]     [ ]    [ ]    [ ] F3 [x]     [x]    [ ]    [ ]     [ ]      [ ]    [x]   [x] F4 [ ]      [x]    [ ]    [ ]    [x]      [ ]    [x]   [ ] F5 [x]     [ ]     [x]   [ ]     [ ]     [x]    [x]    [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.)

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

An integer double-dimensional array called hotel is used to keep track of reservations in an
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 C++ program to manage the hotel reservations by
completing the following:
 Write a function called isFree, 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 isFree 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 R02 R03 R04 R05 R06 R07 R08
F1 [x]     [x]    [ ]    [ ]     [ ]     [x]    [ ]    [ ]
F2 [ ]      [x]    [x]   [ ]     [x]     [ ]    [ ]    [ ]
F3 [x]     [x]    [ ]    [ ]     [ ]      [ ]    [x]   [x]
F4 [ ]      [x]    [ ]    [ ]    [x]      [ ]    [x]   [ ]
F5 [x]     [ ]     [x]   [ ]     [ ]     [x]    [x]    [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.).

Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Arrays
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education