Question
ClassroomDriver.java public class ClassroomDriver { public static void main (String[] args) { System.out.println(----Creating Classrooms----); Classroom room1 = new Classroom(129, 40); Classroom room2 = new Classroom(204,
ClassroomDriver.java
public class ClassroomDriver { public static void main (String[] args) { System.out.println("----Creating Classrooms----"); Classroom room1 = new Classroom(129, 40); Classroom room2 = new Classroom(204, 45); Classroom room3 = new Classroom(331, 40); Classroom room4 = new Classroom(422, 45); Classroom room5 = new Classroom(507, 40); System.out.println("Total of classrooms created: " + Classroom.getClassroomCount()); System.out.println(" ----Creating 1D Array to Store Classrooms----"); Classroom[] array = new Classroom[Classroom.getClassroomCount()]; array[0] = room1; array[1] = room2; array[2] = room3; array[3] = room4; array[4] = room5; System.out.println("Size of array is: " + array.length + " "); System.out.println("----Printing Out Classroom Info----"); for (int i = 0; i
Core Requirements: O In this lab, we will be creating our own Classroom class. Implement the following specification below to create the class. 0 Private Data Members: 0 private int roomNum; 0 private int capacity; O Public Static Data Members: O public static int classroomCount; Define it to be the value of 0 O Constructor: O public Classroom(int roomNumArg, int capacityArg) Q Set (roomNum) to (roomNumArg) 0 Set (capacity) to (capacityArg) Increment (classroomCount) by 1 O Public Methods: 0 public int getRoomNum( Returns the instance data member (this.roomNum) Q public void setRoomNum(int newRoomNum) Set (this.roomNum) to (newRoomNum) O public int getCapacity() 0 Returns the instance data member (this.capacity) O public void setCapacity(int capacityArg) Set (this.capacity) to (capacityArg) O public static int getClassroomCount() O Returns the static data member (classroomCount) Now it's time to test your Classroom class Download and move the provided file ClassroomDriver.java into your project's source folder O Run ClassroomDriver.java and check your resultsExpected Output: CLASSROOM CLASS MUST BE IMPLEMENTED CORRECTLY FOR MATCHING OUTPUT TO SHOW *Note: Must match this exact output -Creating Classrooms- - Total of classrooms created: 5 --Creating 10 Array to Store Classrooms- - - Size of array is: 5 -Printing Out Classroom Info- - -- Classroom 1 Room Number is: 129 Classroom 2 Room Number is: 204 Classroom 3 Room Number is: 331 Classroom 4 Room Number is: 422 Classroom 5 Room Number is: 507 Classroom 1 Capacity is: 40 Classroom 2 Capacity is: 45 Classroom 3 Capacity is: 40 Classroom 4 Capacity is: 45 Classroom 5 Capacity is: 40 - ---Fixing Classroom Info- - - - Classroom 1 New Capacity is: 35 Classroom 4 New Room Number is: 433 - - - - Thank YouStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started