lass contains three independent static methods and contains no fields (none should be added). The Utilities class contains the following 3 static methods that you must implement: 1. QWERTY – If the argument is null, the length is anything other than 6, or if the element values are outside the inclusive bound of 1 to 7 throw the IllegalArgumentException with the message "Invalid parameter". Otherwise return a char array that has input[0] instances of 'Q', followed by input[1] instance of 'W', ....followed by input[5] instances of 'Y'. The length of the returned array should be the exact size needed to accommodate all the letters (no smaller or larger). 2. turnTo1D – You can assume that the parameter array has at least 1 row and all rows are int array (might be an empty int array) and the parameter delta is a positive integer. The method returns a 1D array (possibly empty array) with all the values in array that are in the range of the inclusive bound [valu
The Utilities class contains three independent static methods and contains no fields (none should be added).
The Utilities class contains the following 3 static methods that you must implement:
1. QWERTY – If the argument is null, the length is anything other than 6, or if the element values are outside the inclusive bound
of 1 to 7 throw the IllegalArgumentException with the message "Invalid parameter". Otherwise return a char array that has
input[0] instances of 'Q', followed by input[1] instance of 'W', ....followed by input[5] instances of 'Y'. The length of
the returned array should be the exact size needed to accommodate all the letters (no smaller or larger).
2. turnTo1D – You can assume that the parameter array has at least 1 row and all rows are int array (might be an empty int array)
and the parameter delta is a positive integer. The method returns a 1D array (possibly empty array) with all the values in
array that are in the range of the inclusive bound [value – delta to value + delta ]. Note that value is the second
parameter. The length of the returned array should be the exact size needed to accommodate all the integers (no smaller or larger).
3. concat2D - If the parameter array1 is null or has a length of 0, throw the IllegalArgumentException with the message "Invalid
parameter". Otherwise if array1[i][j] and array2[j][i] are both Strings, concatenate them with an * in between the
strings and assign back to array1[i][j]. If a row is null in array1, do not alter the row. Likewise if array1[i][j] is
null, do not modify the element. Finally, if array2[j][i] does not have a string value (think about all the multiple
possibility for why it might not), concatenate array1[i][j] with a @ and assign back to array1[i][j]. In no
circumstance, should the item that the parameter array2 references be altered after the method call is complete. It is
recommend that you look at the examples in the driver before you code this method.
The UtilitiesRec class contains two independent static recursive methods that you must complete and contains no fields (none should
be added).
The UtilitiesRec class contains the following 2 static recursive methods that you must implement:
1. public changeArraysCopy – Code given. Make no changes.
2. private changeArraysCopy – You can assume both array1 and array2 are not null. This recursive method will assign the
smaller element found in array1[i] and array2[i] to array1[i] (and therefore the larger or equal to array2[i] ).
The recursion stops as soon as one of the 2 arrays runs out of elements. You need to decide the role of the third parameter
index. In implementing your code, the only fields/method you can use are the length field and call the private
changeArraysCopy. There should be no loops in this method.
3. public changeList - Code given. Make no changes.
4. private changeList – You can assume myList is not null. Let us define corresponding elements to be the first element and the
last element, the second element and the second to last element, the third element and the third to last element…..the ith element
and the ith to last element. If the number of elements in myList is odd, the one in the middle does not have a corresponding
element.
This recursive method will alter myList such that value in the first corresponding element will be assigned to the second.
However, if at least one of the two values in the corresponding elements is null, make no change to the pair. Furthermore, if
both corresponding elements have an equal value, assign 131 to both of them. You need to decide the role of the start and
end parameters. In implementing your code, the only fields/method you can use are the get and set method of the ArrayList
class and you can call the private changeList. There should be no loops in this method.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps