Given the following Seat class: class Seat private: string person name; bool isReserved; public: Seat () { person name="N/A"; isReserved=false; } bool reserveFor (string name); bool isFree (); void makeFree (); string whoIsSitting (); } ; Each seat can be occupied by only one person; we can reserve a seat for a person using the resereveFor member function. If the seat is occupied, the isFree function returns false. We make a seat free by calling the makeFree function. The function whols Sitting returns the name of the person sitting on the seat; if it is empty, it returns "N/A". Assume that the Seat class is implemented fully and ready to use, 1. Write a new class called Room. The room class should have 30 seats (private data). Also, write the below four member functions in the Room class. 2. Write bool EnterPerson(string name) member function that can be used to enter a person to the room. You need to give him the first seat available and return false if the room is full. 3. Write bool isRoomFull() member function which returns true if the room is full and false otherwise. 4. Write int SearchPerson(string name) member function which searches for given name and return the seat number of the person if he was in the room otherwise return -1. Valid seat numbers are 0 to 29.

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
C++
Given the following Seat class:
class Seat
{
private:
string person name;
bool isReserved;
public:
Seat () { person name="N/A"; isReserved=false; }
bool reserveFor (string name);
bool isFree ();
void makeFree ();
string whoIsSitting() ;
} ;
Each seat can be occupied by only one person; we can reserve a seat for a person using the resereveFor member function. If the seat is
occupied, the isFree function returns false. We make a seat free by calling the makeFree function. The function whols Sitting returns the name of
the person sitting on the seat; if it is empty, it returns "N/A".
Assume that the Seat class is implemented fully and ready to use,
1. Write a new class called Room. The room class should have 30 seats (private data). Also, write the below four member functions in the
Room class.
2. Write bool EnterPerson(string name) member function that can be used to enter a person to the room. You need to give him the first seat
available and return false if the room is full.
3. Write bool isRoomFull() member function which returns true if the room is full and false otherwise.
4. Write int SearchPerson(string name) member function which searches for given name and return the seat number of the person if he was in
the room otherwise return -1. Valid seat numbers are 0 to 29.
Transcribed Image Text:Given the following Seat class: class Seat { private: string person name; bool isReserved; public: Seat () { person name="N/A"; isReserved=false; } bool reserveFor (string name); bool isFree (); void makeFree (); string whoIsSitting() ; } ; Each seat can be occupied by only one person; we can reserve a seat for a person using the resereveFor member function. If the seat is occupied, the isFree function returns false. We make a seat free by calling the makeFree function. The function whols Sitting returns the name of the person sitting on the seat; if it is empty, it returns "N/A". Assume that the Seat class is implemented fully and ready to use, 1. Write a new class called Room. The room class should have 30 seats (private data). Also, write the below four member functions in the Room class. 2. Write bool EnterPerson(string name) member function that can be used to enter a person to the room. You need to give him the first seat available and return false if the room is full. 3. Write bool isRoomFull() member function which returns true if the room is full and false otherwise. 4. Write int SearchPerson(string name) member function which searches for given name and return the seat number of the person if he was in the room otherwise return -1. Valid seat numbers are 0 to 29.
Expert Solution
steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Knowledge Booster
Function Arguments
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
  • SEE MORE 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