Question
URGENT!!!!!! JAVA CODING QUESTION Board: Create the following function: public static boolean checker(int square, byte[][] board){ return true} The board is divided into 9 squares.
URGENT!!!!!! JAVA CODING QUESTION
Board:
Create the following function:
public static boolean checker(int square, byte[][] board){
return true}
The board is divided into 9 squares. Each square must include the digits 1-9. They don't have to be in order but all squares must include all digits 1-9.
The method takes a byte array and checks if each square includes all digits 1-9. It should check 1 square at a time.
The byte array looks like this:
public static byte[][] board1 = new byte[][]{
{1,2,3,4,5,6,7,8,9},
{4,5,6,7,8,9,1,2,3},
{7,8,9,1,2,3,4,5,6},
{2,3,4,5,6,7,8,9,1},
{5,6,7,8,9,1,2,3,4},
{8,9,1,2,3,4,5,6,7},
{3,4,5,6,7,8,9,1,2},
{6,7,8,9,1,2,3,4,5},
{9,1,2,3,4,5,6,7,8}};
public static byte[][] board2 = new byte[][]{
{1,2,3,4,5,6,7,8,9},
{1,2,3,4,5,6,7,8,9},
{1,2,3,4,5,6,7,8,9},
{1,2,3,4,5,6,7,8,9},
{1,2,3,4,5,6,7,8,9},
{1,2,3,4,5,6,7,8,9},
{1,2,3,4,5,6,7,8,9},
{1,2,3,4,5,6,7,8,9},
{3,4,5,2,8,6,2,7,9}};
When the method checks board1 it should return true. When the method checks board2 it should return false.
Use the following test method to check your program:
public static boolean testMethod(byte[][] board){
for(int square=0; square
if( !checker(square, board) ){
return false;
}
}
Absolutely no classes or imports can be added.
Thanks in advance.
112 314| 516 71819 4|5|6|71819 11213 7181911|2|3 41516 213 31415 4151617 81911 5|6|7181911 21314 8819 91112 112|314151617 31415161718 9|1|2 617 88191112 31415 9|1|2|31415 61718Step 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