Suppose that you are going to create an object used to count the number of people in a room. We know that the number of people in the room can never be negative.

Create a RoomCounter class having three public methods:
• addPerson—adds one person to the room
• removePerson—removes one person from the room
• getCount —returns the number of people in the room
If removePerson would make the number of people less than zero, throw a NegativeCounterException.


See the code in RoomCounter.java.

Computer Science & Information Technology

You might also like to view...

Which of the following is considered cardholder data?

A) Service code B) Full magnetic stripe data C) Security code D) PIN

Computer Science & Information Technology

The table cell element has the _________ precedence.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology

____ mode is actually the bootstrap program that is built into the firmware of the router.

A. NVRAM B. ROM Monitor C. Flash memory D. DRAM

Computer Science & Information Technology

The ___________ of the data bar represents the value in the cell.

a. length b. color c. pattern d. height

Computer Science & Information Technology