Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

* * 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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Graph Databases

Authors: Ian Robinson, Jim Webber, Emil Eifrem

1st Edition

1449356265, 978-1449356262

More Books

Students also viewed these Databases questions

Question

How does selection differ from recruitment ?

Answered: 1 week ago