Question: 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[][]
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:
0 1 0 3 1 6 1 0 1 6 8 6 0 1 5 6 2 1 8 29 6 5 6 1 1 9 1 1 3 6 1 4 07 3 3 3 3 4 0 7 0 1 0 3 1 6 1 0 1 6 8 6 0 1 5 5 2 18 2 9 6 5 6 1 1 9 1 1 5 6 1 4 0 7 0 1 0 3 1 6 1 0 1 6 8 6 0 1 5 6 2 1 6 2 9 6 5 6 6 1 9 1 1 3 6 1 4 07 3 6 3 3 4 07 0 1 0 3 1 6 1 6 8 6 0 1 6 2 1 8 29 6 9 6 1 1 9 1 9 1 40 7 3 5 3 3 4 07 3 3 3 9 4 0 7
Step by Step Solution
3.44 Rating (160 Votes )
There are 3 Steps involved in it
Pattern Recognition Program plan Define a method isConsecutiveFourPattern which will find whether th... View full answer
Get step-by-step solutions from verified subject matter experts
