Question: Implement using Java, a simple hotel reservation system with the following 4 classes: class Room , class SingleRoom, class DoubleRoom and class Hotel, Your implementation

Implement using Java, a simple hotel reservation system with the following 4 classes: class Room , class SingleRoom, class DoubleRoom and class Hotel, Your implementation should ensure encapsulation.

Class Room is abstract each room has: o An integer variable roomNumber. o A boolean variable reserved representing if the room is reserved or not. o A constructor that receives the roomNumber for initialization of the roomNumber instance variable o Accessor method for instance variables. o Mutator method for reserved o An abstract method : public abstract double getPrice( ) Class SingleRoom which extends Room such that: o each single room has a constructor that receives the roomNumber for initialization of the roomNumber instance variable o Implements method getPrice( ) defined in class Room by returning 200.

Class DoubleRoom which extends Room such that: o Each double room has a constructor that receives the roomNumber for initialization of the roomNumber instance variable o Implements method getPrice( ) defined in class Room by returning 300.

Class Hotel, each hotel has: o A String variable name o A variable rooms of type: Room [ ] representing the hotel rooms o A constructor that receives the name , rooms for initialization of instance variables o Accessor methods for instance variables. o A method public boolean isFull( ) which returns true if all the hotel rooms are reserved, otherwise returns false.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!