Answered step by step
Verified Expert Solution
Question
1 Approved Answer
3. 4. ** please use java programming for solution ** /* * Input Parameters: * -seg: a non-empty array of integers * Assumptions: - Input
3.
4.
** please use java programming for solution **
/* * Input Parameters: * -seg: a non-empty array of integers * Assumptions: - Input array seg is not empty. What to return? Return another array of strings, each of which denoting a non-empty suffix of the input array. A suffix of array `seq' contains its last n elements (where 1 Then the output or returned array of string values is: where each suffix is structured as a comma-separated list surrounded by square brackets. Note that the length of the output array is equal to the length of the input array. Also, elements in the output array are sorted by the lengths of the suffixes. (e.g,. the last element is the suffix of length' 1, the second last element is the suffix of length 2). * See the JUnit tests related to this method. */ public static String[] task3(int[] seq) { String[] result = null; . /* Your task is to implement this method, * so that running TestUtilities.java will pass all Junit tests. * * Recall from Week 1's tutorial videos: * 1. No System.out.println statements should appear here. Instead, an explicit, final return statement is placed for you. * 2. No Scanner operations should appear here (e.g., input.nextInt()). Instead, refer to the input parameters of this method. * 3. Do not re-assign any of the parameter/input variables. */ * // Your implementation of this method starts here. // Do not modify this return statement. return result; } * Input Parameters: sa': an array of strings * * Assumptions: - Input array `sa' is non-empty and contains at least one elements. * - The string value that appears the most frequently is unique. * * What to return? - Return the string value that appears the most frequently, * i.e., appear for the highest number of times. * * See the JUnit tests related to this method. */ public static String task4(String[] sa) { String result = null; /* Your task is to implement this method, * so that running TestUtilities.java will pass all JUnit tests. * * Recall from Week 1's tutorial videos: * 1. No System.out.println statements should appear here. Instead, an explicit, final return statement is placed for you. * 2. No Scanner operations should appear here (e.g., input.nextInt()). * Instead, refer to the input parameters of this method. * 3. Do not re-assign any of the parameter/input variables. */ * // Your implementation of this method starts here. // Do not modify this return statement. return result; }Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started