Room.java:
public class Room
{
// fields
private String roomNumber;
private String buildingName;
private int capacity;
public Room()
{
this.capacity = 0;
}
/**
* Constructor for objects of class Room
*
* @param rN the room number
* @param bN the building name
* @param c the room capacity
*/
public Room(String rN, String bN, int c)
{
setRoomNumber(rN);
setBuildingName(bN);
setCapacity(c);
}
 Â
/**
* Mutator method (setter) for room number.
*
* @param rN a new room number
*/
public void setRoomNumber(String rN)
{
this.roomNumber = rN;
}
 Â
/**
* Mutator method (setter) for building name.
*
* @param bN a new building name
*/
public void setBuildingName(String bN)
{
this.buildingName = bN;
}
 Â
/**
* Mutator method (setter) for capacity.
*
* @param c a new capacity
*/
public void setCapacity(int c)
{
this.capacity = c;
}
 Â
/**
* Accessor method (getter) for room number.
*
* @return the room number
*/
public String getRoomNumber()
{
return this.roomNumber;
}
 Â
/**
* Accessor method (getter) for building name.
*
* @return the building name
*/
public String getBuildingName()
{
return this.buildingName;
}
 Â
/**
* Accessor method (getter) for capacity.
*
* @return the capacity
*/
public int getCapacity()
{
return this.capacity;
}
}
Put the ideas into practice by extending the original Room classto create an AcademicRoom.java class.
- The AcademicRoom.java should store information aboutthe building name, room number, capacity, academic departmentassociated with the room (CPSC, MATH, BUAD, ...) and also whetheror not the room contains a projector. Make sure to utilizeinheritance (only add new fields to AcademicRoom).
- Include a constructor for the AcademicRoom class thattakes advantage of the reserved word super. Also includeappropriate getter/setter methods for theAcademicRoom.
- Add James Farmer B6 to your list as well as two orthree other classrooms of your choosing.
- Implement a test program (TestAcademicRoom.java) with amain() that creates an ArrayList of AcademicRooms. After the listis created, allow the user to: (1) add another room to the list,and (2) search for rooms. The program should not add the room if italready exists in the list. The user should search by inputting abuilding name and optionally a room number. If a room number is notprovided, the program should print all rooms in that building. Ifmatches are found in the list, print all the data membersassociated with the AcademicRoom(s).