Question
* * Requirements: * - It is strictly forbidden for you to use: * + Any Java library method (e.g., Arrays.sort) * (That is, there
* * Requirements: * - It is strictly forbidden for you to use: * + Any Java library method (e.g., Arrays.sort) * (That is, there must not be an import statement in the beginning of this class.) * + arrays * - You will receive an immediate zero for this task if the requirement is violated. * * Input Parameters: * - `n1`: first number * - `n2`: second number * - `n3`: third number * - `n4`: fourth number * Note. These four input numbers are not necessarily unique. They might contain duplicates. * * Error conditions (in order of priority): * - None. No error message is needed. * * What to return? * - Return a report of the smallest number and the second smallest number. * * See the JUnit tests related to this method for the precise format of the string return value. */ public static String getSmallestTwoNumbers(int n1, int n2, int n3, int n4) { String result = ""; /* 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