Westonci.ca makes finding answers easy, with a community of experts ready to provide you with the information you seek. Get expert answers to your questions quickly and accurately from our dedicated community of professionals. Discover in-depth answers to your questions from a wide network of professionals on our user-friendly Q&A platform.
Sagot :
Answer:
b. Create a Room class with the instance variables int numBeds, and boolean hasBath. Create a subclass Suite of Room which will inherit the Instance variables of Room and has an additional instance variable int numSubrooms.
Explanation:
In object-oriented program designs, applications are split into sub-tasks and each sub-task is designed by creating as one or more classes to model it. This allows for flexibility and extensibility among other things.
In the case of the large hotel, two classes are of utmost importance:
i. the Room class to hold information about the number of beds in the room and whether or not the room has a bath.
ii. the Suite class to hold, in addition to the information held by the Room class, information about the number of sub-rooms in the suite.
To apply the concept of object-oriented design, since the suite is a special type of room, the Room class will serve as the super class while the Suite class which contains extra information will serve as the subclass inheriting all the properties of the Room class. Therefore the Suite will have all the properties of the Room and also its own special property - number of sub-rooms in this case.
Thank you for choosing our platform. We're dedicated to providing the best answers for all your questions. Visit us again. We hope our answers were useful. Return anytime for more information and answers to any other questions you have. Westonci.ca is here to provide the answers you seek. Return often for more expert solutions.