Expert answer:Need help with my code (java)

Solved by verified expert:Attached is the instructions of the program. I tried my best to solve it, but I stuck in some points. (I will provide you with my code)It is a sudoku game programing. it just ask for 3 methods (isValid(), getValue(), setValue())and a Test of the scenarios of the game.Do not copy any code from any other sources. And follow the instructions.
sdpl_csci.docx

Unformatted Attachment Preview

In this programming assignment, you will implement a 4-by-4 sudoku grid. The rules of
sudoku state that a solved grid is one where every row and column contains distinct values in
the range 1 through 4 (inclusive). In addition, the upper-left, upper-right, lower-left, and
lower-right 2-by-2 squares must also contain distinct values.
In a valid grid, some entries can be empty. In this case, the filled entries of rows, columns,
and 2-by-2 squares must be distinct values in the range 1 through 4.
In this programming assignment you will implement a SudokuGrid class determines whether
its values represent a valid grid.
Tests
This is a measure of how well your tests demonstrate whether or not your implementation is
correct.
Each test method should be based on a scenario – in this case a configuration of the Sudoku
grid that is or is not valid. For example, testAnEmptyGridIsValid is a good test.
Your tests should NOT test a single method. For example, testSetValue is a poor test.
Suggestions
The challenge of this assignment is the isValid method. There are two approaches:

Verify that each entry in a row (column, and square) is not equal to any other (unless they
are both 0).

Verify that each row (column, and square) only contains the values 1, 2, 3, and 4 a single
time.
In my implementation I used the first approach for rows and columns and the second for the
squares.

It is easy to write a long, convoluted implementation for this method. If you recognize that
all rows can be verified using the same basic algorithm, you can write a private helper
method to keep your code clean (same for columns and squares).
When you have working code, ask yourself whether it is good code. If not, refactor and make
it better!

Purchase answer to see full
attachment

Order a plagiarism free paper now. We do not use AI. Use the code SAVE15 to get a 15% Discount

Looking for help with your ASSIGNMENT? Our paper writing service can help you achieve higher grades and meet your deadlines.

Why order from us

We offer plagiarism-free content

We don’t use AI

Confidentiality is guaranteed

We guarantee A+ quality

We offer unlimited revisions

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top