Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

4x4 sudoku please follow stept by step the given directions. thank you. Here are

ID: 3693360 • Letter: 4

Question

4x4 sudoku please follow stept by step the given directions. thank you.

Here are two correct 4x4 Sudoku grids:

  

3

2

4

1

4

1

3

2

1

4

2

3

2

3

1

4

4x4 Sudoku Example #1

1

2

3

4

3

4

1

2

2

1

4

3

4

3

2

1

4x4 Sudoku Example #2

Notice how each row, column and region has the individual numbers from 1 through 4 used only once. This means that the values used in each row, column and region must add up to 10 (1 + 2 + 3 + 4). This is how we will check our 4x4 Sudoku grids for this assignment.

Allow your user to enter their Sudoku grids row-by-row, separating each of the four values by a space and hitting ENTER at the end of the row.

When the user has entered all 16 values into the program, you should output validation checks for each region, row and column. An example run can be seen below with sample user input underlined.

This program checks simple, small, 4x4 Sudoku grids for correctness. Each column, row and 2x2 region contains the numbers 1 through 4 only once.

To check your Sudoku, enter your board one row at a time, with each digit separated by a space. Hit ENTER at the end of a row.

SUDO:VALID

Your program does not have to check for the numbers 1 through 4 being used uniquely in each row, column and region. In other words, don't worry about validating their input to make sure they only enter the digits 1, 2, 3 or 4 and only enter them once per row, column and region. At this point in the semester, writing data validation like that would be incredibly painful.

You simply need to check that each row, column and region adds up to 10.

This simplistic type of checking will, however, allow some bad Sudoku grids to be validated as good. See two examples of this below. For this program, we will let these instances slide and not worry about them.

4

1

1

4

1

4

4

1

1

4

4

1

4

1

1

4

Invalid 4x4 Sudoku That Will Be Labeled as valid, Example #1

10

0

0

0

0

0

10

0

0

10

0

0

0

0

0

10

Invalid 4x4 Sudoku That Will Be Labeled as valid, Example #2

Rows, columns and regions are identified as found below:

ROW1

ROW2

ROW3

ROW4

C

O

L

1

C

O

L

2

C

O

L

3

C

O

L

4

REGION

1

REGION

3

REGION

2

REGUON

4

When producing your output, you must first validate the regions, then the rows and then the columns. Each region, row and column validation should appear on a line by itself using the identifiers REG-1, REG-2, REG-3, REG-4, ROW-1, ROW-2, ROW-3, ROW-4, COL-1, COL-2, COL-3, and COL-4.

Each identifier will be followed immediately by a colon and that colon will be followed immediately by the word GOOD or the word BAD depending on if that row/column/region passes or fails validation.

The final line of output should be the keyword SUDO, followed immediately by a colon, followed immediately by either the word VALID or the word INVALID.

Please see the example run and run the sample program a number of times to make sure you understand how output is expected to be displayed for this program.

UML DIAGRAM FOR CLASS NetID_SudokuChecker
Create a class based on your UNO NetID. Replace NetID in the following example with your UNO NetID.

«constructor» NetID_SudokuChecker ( )

+ displayGrid ( )
+ getGrid ( )
+ checkGrid ( )

DISCUSSION OF CLASS NetID_SudokuChekcer
What follows is a short description of what each data member represents and what each method does:

grid

grid is a private data member that is a 4x4 array of integers. It will store the four rows of four items in each row.

This is the constructor. It should display welcome greetings, explaining the rules of the 4x4 Sudoku grid we're processing.

getGrid()

This public method should read the Sudoku grid from the user row by row, using spaces between values in each row.

This public method simply displays the grid to the screen in a nice, square pattern.

This public method uses the private data member grid to test whether or not the given values are a valid Sudoku grid.

Your method does not have to check for the numbers 1 through 4 being used uniquely in each row, column and region. In other words, don't worry about validating their input to make sure they only enter the digits 1, 2, 3 or 4 and only enter them once per row, column and region. You can add this functionality, but it is not required.

When producing your output, you must first validate the regions, then the rows and then the columns. Each region, row and column validation should appear on a line by itself using the identifiers REG-1, REG-2, REG-3, REG-4, ROW-1, ROW-2, ROW-3, ROW-4, COL-1, COL-2, COL-3, and COL-4.

Each identifier will be followed immediately by a colon and that colon will be followed immediately by the word GOOD or the word BAD depending on if that row/column/region passes or fails validation.

The final line of output should be the keyword SUDO, followed immediately by a colon, followed immediately by either the word VALID or the word INVALID.

Make sure your spelling and formatting for each of the above is correct.

DISCUSSION OF THE FILE NetID_SudokuChecker.java
You will need to implement your class methods in the file NetID_SudokuChecker.java. This file should follow the basic outline here:

import java.util.Scanner;
public class NetID_SudokuChecker {

A MAIN / TEST PROGRAM (NetID_SudokuCheckerTest.java)

To test your implementation of the NetID_SudokuChecker class, use the following code for NetID_SudokuCheckerTest.java,changing NetID to your UNO NetID.

public class NetID_SudokuCheckerTest

{

public static void main ( String args[] )

{

NetID_SudokuChecker sudChecker = new NetID_SudokuChecker();

}

}

SUMMARY OF FILES

You will need to create two files for this assignment:

. NetID_SudokuChecker.java, which will be modeled after the code example seen at the top of this page.

. NetID_SudokuCheckerTest.java, which will contain the code exactly as seen above.

Essentially, you will type in the code exactly as seen in this assignment for both files. You will then plug in the appropriate code into the methods of the NetID_SudokuChecker.java file.

DO NOT CHANGE THE NAMES OF ANY OF THE methods OR THE CLASS ITSELF!!!!!

Goals

Implement a moderately straightforward class that creates three methods (a constructor and two other methods) to implement a Sudoku- checking data type using a UML specification as a guideline for creation of the class.

Points to Think About

Try compiling your class often, after adding maybe five or ten lines of code to your program. By doing this, you’re less likely to have dozens of errors to have to fix after compilation.

You may wish to set up the instance variable and shells for the methods themselves first and compile that code without any real code inside any of the methods. You can also set up the Tester class and try compiling that against your compiled SudokuChecker class.

Then, go back and start filling in code for each of the methods in the SudokuChecker class.

Grading Notes

>> Method documentation is required for all methods other than main()and you must follow the Program Coding Standards handout posted to Blackboard for this course. Points will be deducted for missing or incomplete method documentation.

>> Your methods must behave as outlined in this assignment.

>> Make sure your output follows the format you see in the example solution provided. A portion of your grade is for following this format exactly. If you messed up some of the output on your previous Sudoku solution, now is the time to fix it.

Output Example

Sample Run (user input is underlined)

This program checks simple, small, 4x4 Sudoku grids for correctness. Each column, row and 2x2 region contains the numbers 1 through 4 only once.

To check your Sudoku, enter your board one row at a time, with each digit separated by a space. Hit ENTER at the end of a row.

0 0 0 0

0 0 0 0

0 0 0 0

0 0 0 0

EnterRow1:1 2 3 4

EnterRow2:3 4 2 1

EnterRow3:1 2 3 4

EnterRow4:4 3 2 1

1 2 3 4

3 4 2 1

1 2 3 4

4 3 2 1

Thank you. Now checking ...

sample output run 2

Welcome to the Sudoku Checker v1.0!

This program checks simple, small, 4x4 Sudoku grids for correctness. Each column, row and 2x2 region contains the numbers 1 through 4 only once.

To check your Sudoku, enter your board one row at a time, with each digit separated by a space. Hit ENTER at the end of a row.

0 0 0 0

0 0 0 0

0 0 0 0

0 0 0 0

EnterRow1: 3 2 4 1

EnterRow2: 4 1 3 2

EnterRow3: 1 4 2 3

EnterRow4: 2 3 1 4

3 2 4 1

4 1 3 2

1 4 2 3

2 3 1 4

Thank you. Now checking ...

SUDO:VALID

3

2

4

1

4

1

3

2

1

4

2

3

2

3

1

4

Explanation / Answer

import java.util.Scanner; 002 003 public class atmetoyer_SudokuChecker 117            else 118            { 119                System.out.println ("ROW-2:BAD"); 120                var = var + 1; 121            } 122 123            if ( y1 + y2 + y3 + y4 == 10) 124            { 125                System.out.println ("ROW-3:GOOD"); 126            } 127            else 128            { 129                System.out.println ("ROW-3:BAD"); 130                var = var + 1; 131            } 132 133            if ( z1 + z2 + z3 + z4 == 10) 134            { 135                System.out.println ("ROW-4:GOOD"); 136            } 137            else 138            { 139                System.out.println ("ROW-4:BAD"); 140                var = var + 1; 141            } 142     143            System.out.println(); // Coloumn 144      145            if ( w1 + x1 + y1 + z1 == 10) 146            { 147                System.out.println ("COL-1:GOOD"); 148            } 149            else 150            { 151                System.out.println ("COL-1:BAD"); 152                var = var + 1; 153            } 154 155            if ( w2 + x2 + y2 + z2 == 10) 156            { 157                System.out.println ("COL-2:GOOD"); 158            } 159            else 160            { 161                System.out.println ("COL-2:BAD"); 162                var = var + 1; 163            } 164 165            if ( w3 + x3 + y3 + z3 == 10) 166            { 167                System.out.println ("COL-3:GOOD"); 168            } 169            else 170            { 171                System.out.println ("COL-3:BAD"); 172                var = var + 1; 173            } 174 175            if ( w4 + x4 + y4 + z4 == 10) 176            { 177                System.out.println ("COL-4:GOOD"); 178            } 179            else 180            { 181                System.out.println ("COL-4:BAD"); 182                var = var + 1; 183            } 184 185            System.out.println(); // Flag 186 187            if ( var == 0) 188            { 189                System.out.println ("SUDO:VALID"); 190            } 191            else 192            { 193              System.out.println ("SUDO:INVALID"); 194            } 195            System.out.println(); 196         } 197     198 }      199 200 201      public class atmetoyer_SudokuCheckerTest 2 { 3     public static void main ( String args[] ) 4     { 5         atmetoyer_SudokuChecker foo = new atmetoyer_SudokuChecker(); 6         foo.getGrid(); 7         foo.checkGrid(); 8     } 9 }

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote