Question
package practicePackage._06_sorting.attempts; public class Stage3 { /** * * @param data * @return the array after it has been sorted so that all the odd
package practicePackage._06_sorting.attempts;
public class Stage3 {
/**
*
* @param data
* @return the array after it has been sorted so that all the odd numbers are
* sorted after the even numbers. The two groups should be sorted in
* ascending order.
*/
public static int[] sortOddEven(int[] data) {
return null; //to be completed
}
package practicePackage._06_sorting.testAttempts;
import static org.junit.jupiter.api.Assertions.*;
import java.util.Arrays;
import org.junit.jupiter.api.Test;
import practicePackage._06_sorting.attempts.*;
public class TestStage3 {
@Test
public void testSortOddEven() {
assertNull(Stage3.sortOddEven(null));
assertEquals("[10, 20, 70]", Arrays.toString(Stage3.sortOddEven(new int[] { 20, 70, 10 })));
assertEquals("[-75, 15, 25]", Arrays.toString(Stage3.sortOddEven(new int[] { 25, -75, 15 })));
assertEquals("[4, 10, 20, 70, 5, 11]", Arrays.toString(Stage3.sortOddEven(new int[] { 11, 20, 5, 70, 10, 4 })));
assertEquals("[-4, 10, 20, 70, -11, -5]",
Arrays.toString(Stage3.sortOddEven(new int[] { -4, 20, 70, -5, 10, -11 })));
}
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