Question: Jse the given two classes. The OuterMain.java is completed so you don't need to modify. Implement the two incomplete methods, getNumOfAvailableSeats() and assignOneSea that the






Jse the given two classes. The OuterMain.java is completed so you don't need to modify. Implement the two incomplete methods, getNumOfAvailableSeats() and assignOneSea that the generator works properly. Key concepts to learn: the object instantiation the usage of ArrayList keep track of available seats using an ArrayList o random selection o item removal Submit the completed Classroom.java OuterMain.java Classroom.java import java.util.Scanner; * 4A - Random Seating Generator (for a traditional classroom) * Scenario when a student comes into the classroom, the program assign a random seat for the student. * Seat numbering (as showns in the chart below): row number starts at 1 column number starts at A Podium B | C D | 1C1D 2 2D 11 3 1 3A 11 . Problem description: the OuterMain is completed - you don't need to modify anything for it. Implement the incomplete methods in the classroom.java to make it work public class OuterMain { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int rows = 0; int cols = 0; String userChoice - 1/Ask user for the number of rows in the classroom System.out.println("How many rows in the classroom?"); TOWS - 50.nextInt(); 1/Ask user for the number of rows in the classroom System.out.println("How many columns in the classroom?"); cols - sc.nextInt(); sc.nextLine(); //Create classroom Classroom room - new Classroom(rows, cols) public class Outermain { public static void main(String[] args) { Scanner sc-new Scanner(System.in); int rows - 0; int cols = 0; String userChoice = ""; //Ask user for the number of rows in the classroom System.out.println("How many rows in the classroom?"); rows sc.nextInt(); I/Ask user for the number of rows in the classroom System.out.println("How many columns in the classrooni."); cols = sc.nextInt(); sc.nextLine(); //Create classroom Classroom room = new Classroom(rows, cols); room.printSeats(); //repeatedly assign a seat while(true) { if(room.getNumofAvailableSeats() listofAvailableSeat IDs; private Random rand; //a random number generator //- ------Constructors-- - 7/default constructorino-arg, initial the room to a default 4 X 5 classroom public classroom() { //set up the classroom with default this.numof Rows-4; this.numo Columns - 5: //creates seats in the room and set them to available initializeRoom(); 1/create the list of available seats and initialize it to includes all seat ID initializetistofAvalableSeats(); rand - new Random(); //argument constructor public classroom(int numof Rows, int numorColumns) { // set up the classroom with argument row and column numbers this.numot Rows - num Rows //argument constructor public classroom(int numOf Rows, int numofColumns) { 7/set up the classroom with argument row and column numbers this.numofRows = numofRows; this.numofColumns - numofColumns; //creates seats in the room and set them to available initializeRoom(); //create the list of available seats and initialize it to ncludes all seat IDs initializeListof AvalableSeats(); rand = new Random(); // ===-=- -------Setters & Getters----- public void setNumofRows(int numof Rows) { this.numofRows = numofRows; public int get NumOfRows() { return numof Rows; public void setNumOfCols (int numofCols) { this.numof Columns = numofColumns; public int get Numof Columns() { return numofColumns; public void getSeats() { printSeats(); ----More Methods- // --- getNumofAvailableSeats * @return the number of available seats in the run time public int get Numof AvailableSeats() { //* ** ********* ****You code here return numofRows . numofColumns; / initializelisto AvalableSeats: create the list of IDs for all seats / public void initializeListof AvalableSeats() { Blanc return numofRows* numofColumns; /*initializeListofAvalableSeats: create the list of IDs for all seats public void initializeListofAvalableSeats() { listof AvailableSeat IDs - new ArrayList
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
