Question: the program has to be in java language 2. Create a class Room that can be used to record the number of people in the

 the program has to be in java language 2. Create a

the program has to be in java language

2. Create a class Room 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 totalNumberthe 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 numberIn Room 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 Submit a demo file that uses this file and tests the methods created above

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!