Problem

Write a program that tests the class RoomOccupancy that can be used to record the number o...

Write a program that tests the class 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

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

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
Solutions For Problems in Chapter 6
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT