Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Java coding question

Board:

image text in transcribed

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 61718

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 Processing

Authors: David Kroenke

11th Edition

0132302675, 9780132302678

More Books

Students also viewed these Databases questions

Question

1. Identify outcomes (e.g., quality, accidents).

Answered: 1 week ago