(Solved) : Define Class Hotelroom Class Following Private Data Members Room Number Integer Daily Rate Q39675479 . . .

Define the class HotelRoom. The class has thefollowing private data members: the room number(an integer) and daily rate (a double). Include adefault constructor as well as a constructor with two parameters toinitialize the room number and the room’s daily rate. The classshould have get/set functions for all its private data members[20pts]. The constructors and the get/set functions must throw aninvalid_argument exception if either one of theparameter values are negative. The exception handler should displaythe message “Negative Parameter” [20pts]. Include atoString() function that nicely formats andreturns a string that displays the information about the hotel room[10pts].

  1. Write a main function to test the classHotelRoom, create a HotelRoomobject. Try to set the room rate to an invalid value to generate anexception. Invoke the toSting() function todisplay the HotelRoom object. [20pts]
  2. Derive the classes GuestRoom form the baseclass HotelRoom. The GuestRoomhas private data fields and public functions:
    1. The private data field capacity (an Integer)that represents the maximum number of guests that can occupy theroom. [5pts]
    2. The private data member status (an integer),which represents the number of guests in the room (0 ifunoccupied). [5pts]
    3. An integer data field days that represents thenumber of days the guests occupies the room. [5pts]
    4. Add constructors and get/set functions to theGuestRoom class. The set function for thestatus data member must throw anout_of_range exception if it tries to set statusto value greater than the capacity. [30pts]
    5. The function calculateBill() that returns theamount of guest’s bill. [10pts]
    6. Redefine the functiontoString() that formats and returns a stringcontaining all pertinent information about theGuestRoom. [15pts]
  3. Derive the classes MeetingRoom form the baseclass HotelRoom. The class has the followingprivate data filed sand public functions:
    1. A private data field seats, which representsthe number of seats in the room. [5pts]
    2. An integer data field status (1 if the room isbooked and 0 otherwise). [5pts]
    3. Add constructors and get/set functions to theGuestRoom class. [10pts]
    4. Redefine the functiontoSting() to format and return a string containingall pertinent information about the MeetingRoom. [20pts]
    5. The function CalculateBill(), which returnsthe amount of the bill for renting the room for one day. Thefunction calculates the bill as follows: the number of seatsmultiplied by 10.00, plus 500.00. [20pts]
  4. Write a main function to test the classesGuestRoom and MeetingRoom. Invokethe calculateBills and toStirng()in each of the objects. [40pts]]
  5. Make changes to the HotelRoom class toimplement polymorphism. Add avirtual function calculateBill()that returns 0.00 and make the toString() functionin the HotelRoom class a virtual function. Write the functiondisplayHotelRoom() that receive a base class typereference as a parameter, then invokes the functionscalculateBill() and toString().The function must return void. [50pts]
  6. From the main function invoke the functiondisplayHotelRoom() three separate times and eachtime send a HotelRoom, aGuestRoom, and a MeetingRoom typeobjects. [20pts]

  7. Repeat parts e and f but make appropriate changes in such a waythat HotelRoom is turned into an abstract baseclass. [50pts]

Expert Answer


Answer to Define the class HotelRoom. The class has the following private data members: the room number (an integer) and daily rat…

Leave a Comment

About

We are the best freelance writing portal. Looking for online writing, editing or proofreading jobs? We have plenty of writing assignments to handle.

Quick Links

Browse Solutions

Place Order

About Us

× How can I help you?