Question: //JAVA //JAVA (Pattern recognition: four consecutive equal numbers) Write the following method that tests whether a two-dimensional array has four consecutive numbers of the same
//JAVA
//JAVA
(Pattern recognition: four consecutive equal numbers) Write the following method that tests whether a two-dimensional array has four consecutive numbers of the same value, either horizontally, vertically, or diagonally.
public static boolean isConsecutiveFour(int[][] values) Write a test program that prompts the user to enter the number of rows and columns of a two-dimensional array and then the values in the array and displays true if the array contains four consecutive numbers with the same value. Otherwise, display false. Here are some examples of the true cases:4
JAVA JAVA JAVA .// INCLUDE COMMENT LINES
8.19 (Pattern recognition: four consecutive equal numbers) Write the following method that tests whether a two-dimensional array has four consecutive num- bers of the same value, either horizontally, vertically, or diagonally. public static boolean isconsecutiveFourcint values) Programming Exercises 313 Write a test program that prompts the user to enter the number of rows and col- umns of a two-dimensional array and then the values in the array and displays true if the array contains four consecutive numbers with the same value. Other- wise, display false. Here are some examples of the true cases: 0 1 0 3 16 1 0 1 0 3 1 6 1 0 1 0 3 1 6 1 0 1 0 3 1 6 1 0 1 6 8 6 0 1 0 1 6 8 6 0 1 0 1 6 8 6 0 1 0 1 6 8 0 1 5 6 2 1 8 2 9 5 5 2 1 8 29 5 6 2 1 6 2 9 9 6 2 1 8 29 6 56 1 1 9 1 6 5 6 1 1 9 1 6 5 6 6 1 9 1 6 9 6 1 1 9 1 1 36 1 4 0 7 1 56 1 4 0 7 1 3 6 1 4 0 7 1 3 9 1 4 0 7 3 3 3 3 4 0 7 3 3 3 4 0 7 3 6 3 3 4 0 7 3 3 3 9 4 0 7
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
