Welcome to Westonci.ca, the place where your questions find answers from a community of knowledgeable experts. Discover in-depth solutions to your questions from a wide range of experts on our user-friendly Q&A platform. 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.
Thanks for using our platform. We're always here to provide accurate and up-to-date answers to all your queries. Thank you for choosing our platform. We're dedicated to providing the best answers for all your questions. Visit us again. Thank you for using Westonci.ca. Come back for more in-depth answers to all your queries.