2025 AP Computer Science A FRQ #3A

Write the constructor for the Round class. The constructor should initialize competitorList to contain one Competitor object for each name in the String[] names. The order in which Competitor objects appear in competitorList should be the same as the order in which they appear in names, and the rank of each competitor is based on the competitor’s position in names. Names are listed in names in order from the best ranked competitor with rank 1 to the worst-ranked competitor with rank n, where n is the number of elements in names. For example, assume the following code segment is executed. String[] players = {"Alex", "Ben", "Cara"}; Round r = new Round(players); The following shows the contents of competitorList in r after the constructor has finished executing. Complete the Round constructor. /** Initializes competitorList, as described in part (a) */ public Round(String[] names) Intro: 00:00 Writing the pseudocode: 01:44 Writing the code: 03:43 Testing the code: 07:32 Final solution: 10:41