Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please Help me with this ASAP public static int[] task4(int[] seq) { int[] result = null; /* Your task is to implement this method, *

Please Help me with this ASAP

public static int[] task4(int[] seq) { int[] 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; } }

/* * Tests related to Task 4 */ @Test public void test_task4_1() { int[] seq = {3, 1, 1, 1, 2, 2, 2, 2}; int[] expected = {1, 3, 3, 1, 4, 2}; assertArrayEquals(expected, Utilities.task4(seq)); }

@Test public void test_task4_2() { int[] seq = {1, 1, 1, 2, 2, 2, 2}; int[] expected = {3, 1, 4, 2}; assertArrayEquals(expected, Utilities.task4(seq)); } @Test public void test_task4_3() { int[] seq = {2, 2, 2, 2, 1, 1, 1}; int[] expected = {4, 2, 3, 1}; assertArrayEquals(expected, Utilities.task4(seq)); } }

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

Database Modeling And Design

Authors: Toby J. Teorey, Sam S. Lightstone, Tom Nadeau, H.V. Jagadish

5th Edition

0123820200, 978-0123820204

More Books

Students also viewed these Databases questions