Question: In Java Programming, Sample Out : True Source code: import java.util.*; class Program { public boolean classPhotos( ArrayList redShirtHeights, ArrayList blueShirtHeights) { // Write your

In Java Programming,

In Java Programming, Sample Out : True Source code: import java.util.*; class

Sample Out :

True

Source code:

import java.util.*;

class Program {

public boolean classPhotos( ArrayList redShirtHeights, ArrayList blueShirtHeights) { // Write your code here. Collections.sort(redShirtHeights, Collections.reverseOrder()); Collections.sort(blueShirtHeights, Collections.reverseOrder()); String shirtColorInFirstRow = (redShirtHeights.get(0) = blueShirtHeight) { return false; } } else { if (blueShirtHeight >= redShirtHeight) { return false; } } }

return true; } }

QUESTION:

From the question and source code above, how can we create the test cases code to add for the above source code to have the input like the attached picture and the program will display the output "True" or "False". Thanks

It's photo day at the local school, and you're the photographer assigned to take class photos. The class that you'll be photographing has an even number of students, and all these students are wearing red or blue shirts. In fact, exactly half of the class is wearing red shirts, and the other half is wearing blue shirts. You're responsible for arranging the students in two rows before taking the photo. Each row should contain the same number of the students and should adhere to the following guidelines: All students wearing red shirts must be in the same row. All students wearing blue shirts must be in the same row. Each student in the back row must be strictly taller than the student directly in front of them in the front row. You're given two input arrays: one containing the heights of all the students with red shirts and another one containing the heights of all the students with blue shirts. These arrays will always have the same length, and each height will be a positive integer. Write a function that returns whether or not a class photo that follows the stated guidelines can be taken. Note: you can assume that each class has at least 2 students. Sample Input = redshirtHeights blueShirtHeights [5, 8, 1, 3, 4] [6, 9, 2, 4, 5] >

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!