Question
Java: Create a class called Hotel that includes: numberOfRooms (int). It can be accessed in any class. In addition, it's value cannot be changed during
Java: Create a class called Hotel that includes:
numberOfRooms (int). It can be accessed in any class. In addition, it's value cannot be changed during the run, and this value will be shared by all objects.
numberOfReservedRooms (int). It can be accessed by this class only, and its value will be shared by all objects.
numberOfAvailableRooms (int). It can be accessed by this class only, and its value will be shared by all objects.
A constructor receives the numberOf WantedRoomsToReserve and:
Increase the reserved rooms
Decrease the available rooms
Constructor with no-arg to invoke the first constructor and:
Increase the reserved rooms by 1.
Decrease the available rooms by 1.
Getters for the required variables.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started