2018 CSA FRQ 3B

This question involves reasoning about arrays of integers. You will write two static methods, both of which are in a class named ArrayTester. public class ArrayTester { /* Returns an array containing the elements of column c of arr2D in the same order as they appear in arr2D. Precondition: c is a valid column index in arr2D. Postcondition: arr2D is unchanged. */ public static int [] getColumn (int [1 [] arr2D, int c) { /* implementation not shown */ } /* Returns true if and only if every value in arr1 appears in arr2. Precondition: arr1 and arr2 have the same length. • Postcondition: arr1 and arr2 are unchanged. */ public static boolean hasAllValues (int [] arr1, int [] arr2) { /* implementation not shown */ } // Returns true if arr contains any duplicate values; false otherwise. public static boolean containsDuplicates (int [] arr) { /* implementation not shown */ } /* Returns true if square is a Latin square as described in part (b); false otherwise. Precondition: square has an equal number of rows and columns. square has at least one row. */ public static boolean isLatin (int [1 [] square) { /* Your code goes here */ } } Write the static method isLatin, which returns true if a given two-dimensional square array is a Latin square, and otherwise, returns false. A two-dimensional square array of integers is a Latin square if the following conditions are true. - The first row has no duplicate values. - All values in the first row of the square appear in each row of the square. - All values in the first row of the square appear in each column of the square. Feel free to use functions defined in the ArrayTester class to help you public static boolean isLatin (int[] square) { CODE TEXTBOX }