Question: Please help me for this assignment!! ASAP. This is JAVA using in ECLIPSE. JUST PART 1 java in eclipse Part 1: class NConsecutive Implement the

 Please help me for this assignment!! ASAP. This is JAVA usingin ECLIPSE. JUST PART 1 java in eclipse Part 1: class NConsecutiveImplement the hasnConsecutive () method to test whether the supplied array hasa specified number of consecutive, same-valued elements. public static boolean hasConsecutive (int[]

Please help me for this assignment!! ASAP.

This is JAVA using in ECLIPSE.

JUST PART 1
java in eclipse
values, int runLength) You need to handle the case where there are

Part 1: class NConsecutive Implement the hasnConsecutive () method to test whether the supplied array has a specified number of consecutive, same-valued elements. public static boolean hasConsecutive (int[] values, int runLength) You need to handle the case where there are no elements in the array - there's nothing to match so you can't find n-consecutive so return false. Similarly, you already know the answer (also false) if the length of the array is smaller than the number of elements you're looking for. The JUnit tests are in NConsecutive DMRTests.java. I included sample output below. Part 2: class NConsecutive UI Write a test program that prompts the user to enter a series of integers and displays whether the series contains runLength consecutive same-valued elements. Your program's main() must prompt the user to enter the input size (the number of values in the series - dynamically allocate an appropriately sized array), the number of consecutive same-valued elements to match, and the sequence of integer values to check. The return value indicates whether at least one run of runLength elements exists in values. Implement the test program in the NConsecutiveUI class (the main() method is already in place). import statements for Scanner and hasnConsecutive () are already in place. Two sets of output from NConsecutive DMRTests follow: 1. test results of a correct implementation 2. test results of NConsecutive with all stub responses (from the template I provided to you) Expected summary output (on console) from NConsecutiveDMRTests - correct implementation: Detailed log in: C:\- Java Workspace - Demo\CS II -- DMR -- Lab 01 (2020-1sp)\test- logs \NConsecutiveDMRTests-2020-01-26-155911. log Starting tests of class NConsecutive [1] Starting tests of has Consecutive() [1] Successfully completed 18 of 18 tests (100%) of hasnConsecutive() Summary Test Results [1] Successfully completed 18 of 18 tests (100%) of has Consecutive() Successfully completed 18 of 18 tests (100%) attempted for class NConsecutive Expected detailed output (in named log) from NConsecutiveDMRTests - correct implementation: Detailed log in: C:\- Java Workspace - Demo\CS II -- DMR -- Lab 01 (2020-1sp)\test- logs \NConsecutive DMRTests -2020-01-26-155911. log Starting tests of class NConsecutive Successfully completed 18 OF 18 tests (100%) attempted for class Nconsecutive Expected detailed output (in named log) from NConsecutive DMRTests - correct implementation: Detailed log in: C:\- Java Workspace - Demo\CS II -- DMR -- Lab 01 (2020-1sp) \test- logs\NConsecutive DMRTests-2020-01-26-155911.log Starting tests of class NConsecutive [1] Starting tests of hasConsecutive() [1, 1] Testing: hasConsecutive( [1, 1], 1) expect: true actual: true [1, 1] Test passed [1, 2] Testing: hasConsecutive [1], 1) expect: true actual: true [1, 2] Test passed [1, 3 s] Testing: has Consecutive [1, 2, 3], 2) expect: false actual: false [1, 3 s] Test passed [1, 4 s] Testing: hasConsecutive( [1, 1, 1, 1], 2) expect: true actual: true [1, 4 s] Test passed [1, 5 s) Testing: hasConsecutive (1, 1, 1, 1], 3 ) expect: true actual: true [1, 5 s] Test passed [1, 6 s] Testing: hasConsecutive( [1, 1, 1, 1], 4) expect: true actual: true [1, 6 s] Test passed [1, 7 s) Testing: hasNConsecutive( [1, 1, 1, 1], 5) expect: false actual: false [1, 7 s] Test passed [1, 8 s] Testing: hasConsecutive( [1, 1, 2, 3], 2) expect: true actual: true [1, 8 s] Test passed 11, 9 s] Testing: has Consecutive( (1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3), 14 ) expect: true actual: true [1, 9 s] Test passed [1, 10 s] Testing: has Consecutive( [1, 2, 3, 4, 4], 2) expect: true actual: true 70 / 8 9 * Implement a method ({@code has Consecutive() }) to test whether the user entered a user-specified number of consecutive, same-valued numbers. * @author * Aversion 1.0.0 2020-01-26 initial version per assignment public class NConsecutive * Test whether {@code values) has a specified number of consecutive, same-valued elements * @param values The array of numbers to check for a sequence of consecutive, same-valued elements * @param runLength The number of occurrences we are looking for in {@code values} * @return {@code true} if at least one sequence of {@code runLength}, same -valued entries exists; {@code false} otherwise HV/ end hasNConsecutive() * You can use the main() method to test your implementation of * has Consecutive() * @param args -unused public static void main(String[] args) Part 1: class NConsecutive Implement the hasnConsecutive () method to test whether the supplied array has a specified number of consecutive, same-valued elements. public static boolean hasConsecutive (int[] values, int runLength) You need to handle the case where there are no elements in the array - there's nothing to match so you can't find n-consecutive so return false. Similarly, you already know the answer (also false) if the length of the array is smaller than the number of elements you're looking for. The JUnit tests are in NConsecutive DMRTests.java. I included sample output below. Part 2: class NConsecutive UI Write a test program that prompts the user to enter a series of integers and displays whether the series contains runLength consecutive same-valued elements. Your program's main() must prompt the user to enter the input size (the number of values in the series - dynamically allocate an appropriately sized array), the number of consecutive same-valued elements to match, and the sequence of integer values to check. The return value indicates whether at least one run of runLength elements exists in values. Implement the test program in the NConsecutiveUI class (the main() method is already in place). import statements for Scanner and hasnConsecutive () are already in place. Two sets of output from NConsecutive DMRTests follow: 1. test results of a correct implementation 2. test results of NConsecutive with all stub responses (from the template I provided to you) Expected summary output (on console) from NConsecutiveDMRTests - correct implementation: Detailed log in: C:\- Java Workspace - Demo\CS II -- DMR -- Lab 01 (2020-1sp)\test- logs \NConsecutiveDMRTests-2020-01-26-155911. log Starting tests of class NConsecutive [1] Starting tests of has Consecutive() [1] Successfully completed 18 of 18 tests (100%) of hasnConsecutive() Summary Test Results [1] Successfully completed 18 of 18 tests (100%) of has Consecutive() Successfully completed 18 of 18 tests (100%) attempted for class NConsecutive Expected detailed output (in named log) from NConsecutiveDMRTests - correct implementation: Detailed log in: C:\- Java Workspace - Demo\CS II -- DMR -- Lab 01 (2020-1sp)\test- logs \NConsecutive DMRTests -2020-01-26-155911. log Starting tests of class NConsecutive Successfully completed 18 OF 18 tests (100%) attempted for class Nconsecutive Expected detailed output (in named log) from NConsecutive DMRTests - correct implementation: Detailed log in: C:\- Java Workspace - Demo\CS II -- DMR -- Lab 01 (2020-1sp) \test- logs\NConsecutive DMRTests-2020-01-26-155911.log Starting tests of class NConsecutive [1] Starting tests of hasConsecutive() [1, 1] Testing: hasConsecutive( [1, 1], 1) expect: true actual: true [1, 1] Test passed [1, 2] Testing: hasConsecutive [1], 1) expect: true actual: true [1, 2] Test passed [1, 3 s] Testing: has Consecutive [1, 2, 3], 2) expect: false actual: false [1, 3 s] Test passed [1, 4 s] Testing: hasConsecutive( [1, 1, 1, 1], 2) expect: true actual: true [1, 4 s] Test passed [1, 5 s) Testing: hasConsecutive (1, 1, 1, 1], 3 ) expect: true actual: true [1, 5 s] Test passed [1, 6 s] Testing: hasConsecutive( [1, 1, 1, 1], 4) expect: true actual: true [1, 6 s] Test passed [1, 7 s) Testing: hasNConsecutive( [1, 1, 1, 1], 5) expect: false actual: false [1, 7 s] Test passed [1, 8 s] Testing: hasConsecutive( [1, 1, 2, 3], 2) expect: true actual: true [1, 8 s] Test passed 11, 9 s] Testing: has Consecutive( (1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3), 14 ) expect: true actual: true [1, 9 s] Test passed [1, 10 s] Testing: has Consecutive( [1, 2, 3, 4, 4], 2) expect: true actual: true 70 / 8 9 * Implement a method ({@code has Consecutive() }) to test whether the user entered a user-specified number of consecutive, same-valued numbers. * @author * Aversion 1.0.0 2020-01-26 initial version per assignment public class NConsecutive * Test whether {@code values) has a specified number of consecutive, same-valued elements * @param values The array of numbers to check for a sequence of consecutive, same-valued elements * @param runLength The number of occurrences we are looking for in {@code values} * @return {@code true} if at least one sequence of {@code runLength}, same -valued entries exists; {@code false} otherwise HV/ end hasNConsecutive() * You can use the main() method to test your implementation of * has Consecutive() * @param args -unused public static void main(String[] args)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!