Question: Step 2. Next you will modify the printRoom function so that it prints names of students in a room, not just the room number. This

 Step 2. Next you will modify the printRoom function so thatit prints names of students in a room, not just the room

Step 2. Next you will modify the printRoom function so that it prints names of students in a room, not just the room number. This function has an argument room (the room number). It has two other arguments that are parallel arrays: assignedRooms and studentNames. The first array specifies which room each student is assigned to, while the second contains their names. Here's an example of what those arrays might look like in this program: index assignedRooms studentNames 0 0 Ava 1 0 Ben N 0 Carol 3 1 Dan 4 1 Emma Write a loop that considers each student in turn, and prints out the names of those students whose entry in assignedrooms match the room argument. For the example arrays shown above, if room == 1, then printRoom would output the names Dan and Emma under the dashed line. So running the program again should produce this: $ java-introcs ZoomRooms greedy 3 Room: 0 Ava Ben Carol Room: 1 Dan Emma // Prints out the students in one room public static void printRoom(int room, int[] assignedRooms, String[] studentNames) { Stdout.println(); // begin with a blank line to separate from anything above stdout.println("Room: " + room); stdout.println(" --"); 1/ STUDENT CODE BEGIN STEP 2 1 // STUDENT CODE END STEP 2 }

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!