Question: Solve this by using JAVA Show me the OUTPUT! Please solve everything! 1 Assignment 1 Our first assignment will reinforce the difference between static and
1 Assignment 1 Our first assignment will reinforce the difference between static and non- until Monday when I get the chance to teach you about the difference people in the rooms of a building. The class has the attributes static variables and methods. This one is the easiest, but will have to wait Create a class RoomOccupancy that can be used to record the number of numberInRoom- the number of people in a room totalNumber the total number of people in all rooms. Since this is shared among all instances of RoomOccupancy static variable. Make it private too. The class has the following methods: adiaeToteo ads a person to therom 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 Create a few Roomoccupancy classes and confirm they work. 2 Exercise 2 complex number. A complex Create a ComplexNumber class to represent a number is a number that's of the form a-+bi, where a and b are real numbers
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
