Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribedimage text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Database Foundations Technology Fundamentals For IT Success

Authors: Bob Bryla

1st Edition

0782143725, 9780782143720

Students also viewed these Databases questions