Question: SudokuDemo Code is as follows: public class SudokuDemo { public static void main(String[] args) { int[][] SudokuSolution={ {5,3,4,6,7,8,9,1,2}, {6,7,2,1,9,5,3,4,8}, {1,9,8,3,4,2,5,6,7}, {8,5,9,7,6,1,4,2,3}, {4,2,6,8,5,3,7,9,1}, {7,1,3,9,2,4,8,5,6}, {9,6,1,5,3,7,2,8,4}, {2,8,7,4,1,9,6,3,5},

 SudokuDemo Code is as follows: public class SudokuDemo { public staticvoid main(String[] args) { int[][] SudokuSolution={ {5,3,4,6,7,8,9,1,2}, {6,7,2,1,9,5,3,4,8}, {1,9,8,3,4,2,5,6,7}, {8,5,9,7,6,1,4,2,3}, {4,2,6,8,5,3,7,9,1}, {7,1,3,9,2,4,8,5,6},

SudokuDemo Code is as follows:

public class SudokuDemo { public static void main(String[] args) { int[][] SudokuSolution={

{5,3,4,6,7,8,9,1,2}, {6,7,2,1,9,5,3,4,8}, {1,9,8,3,4,2,5,6,7}, {8,5,9,7,6,1,4,2,3}, {4,2,6,8,5,3,7,9,1}, {7,1,3,9,2,4,8,5,6}, {9,6,1,5,3,7,2,8,4}, {2,8,7,4,1,9,6,3,5}, {3,4,5,2,8,6,1,7,9} }; int[][] SudokuSolutionFalse={

{5,3,4,6,7,8,9,1,9}, {6,7,2,1,9,5,3,4,8}, {1,9,8,3,4,2,5,6,7}, {8,5,9,7,6,1,4,2,3}, {4,2,6,8,5,3,7,9,1}, {7,1,3,9,2,4,8,5,6}, {9,6,1,5,3,7,2,8,4}, {2,8,7,4,1,9,6,3,5}, {3,4,5,2,8,6,1,7,9} }; int[][] SudokuSolutionFalse2={

{5,3,4,6,7,8,9,1,999}, {6,7,2,1,9,5,3,4,8}, {1,9,8,3,4,2,5,6,7}, {8,5,9,7,6,1,4,2,3}, {4,2,6,8,5,3,7,9,1}, {7,1,3,9,2,4,8,5,6}, {9,6,1,5,3,7,2,8,4}, {2,8,7,4,1,9,6,3,5}, {3,4,5,2,8,6,1,7,9} }; // Test Constructor Sudoku testSudoku = new Sudoku(SudokuSolution); Sudoku testSudokuFalse = new Sudoku(SudokuSolutionFalse); Sudoku testSudokuFalse2 = new Sudoku(SudokuSolutionFalse2); // Test isValidSolution() System.out.println(testSudoku.isValidSolution()); // output true System.out.println(testSudokuFalse.isValidSolution()); // output false System.out.println(testSudokuFalse2.isValidSolution()); // output false // Test showSudoku() // Expected output: /* 5,3,4,6,7,8,9,1,2, 6,7,2,1,9,5,3,4,8, 1,9,8,3,4,2,5,6,7, 8,5,9,7,6,1,4,2,3, 4,2,6,8,5,3,7,9,1, 7,1,3,9,2,4,8,5,6, 9,6,1,5,3,7,2,8,4, 2,8,7,4,1,9,6,3,5, 3,4,5,2,8,6,1,7,9, */ testSudoku.showSudoku(); // Test getSudokuSize() System.out.println(testSudoku.getSudokuSize()); // output 9 } }

CSC 142 Spring 2018 Homework2 Due date: 03/26/2018 Before the class Name: This homework contains 3 pages and 1 questions. Group Project: 2 people per group. DO NOT code from stackexchange, voutube, stackoverflow, github...ctc 1. Sudoku Class. Sudoku is a logic-based, combinatorial number-placement puzzle. The objective is to fill a 9x9 grid with digits so that each column, each row, and cach of the nine 3x3 subgrids that compose the grid contains all of the digits from 1 to 9. The puzzle setter provides a partially completed grid, which for a well-posed puzzle has a single solution Completed games are always a type of Latin square with an additional constraint on the contents of individual regions. For example, the same single integer may not appear twice in the same row, column, or any of the nine 3x3 subregions of the 9x9 playing board. 3 6 489 7 Figure 1: 9x9 Sudoku Rules. For this homework, please create a Sudoku Class (Sudoku.java) based on the following UML graph, that will allows the user to pass a solved Sudoku (represented in a two-dimensional array) and output if the given solution is correct (true) or not (false sudokuArray is a two-dimensional array for storing the Sudoku solution

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!