Question: Problem: Create a class called RoomOccupancy that can be used to record the number of people in the rooms of a building. The class has
Problem: Create a class called RoomOccupancy that can be used to record the number of people in the rooms of a
building. The class has the attributes:
numberInRoom the number of people in a room
totalNumber the total number of people in all rooms as a STATIC variable
roomCharges the charge for the nightly occupancy of the room, in dollars.
The class has the following methods:
addOneToRoom adds a person to the room and increases the value of totalNumber.
removeOneFromRoom removes a person from the room, ensuring that numberInRoom
does not go below zero, and decreases the value of totalNumber as needed.
getNumber returns the number of people in the room.
getTotal a static method that returns the total number of people.
In addition, the usual methods will be included, as usual:
At least TWO constructors a default/no argument constructor and an overloaded
constructor.
The accessor and mutator methods ( getters and setters ).
The toString method.
The equals method ( use the model used in the Person class)
The finalize method
The copy constructor
Write a client/test program to exercise the RoomOccupancy class.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
