EECS2030 Test 2

Version G


GETTING STARTED

  1. Start eclipse; use the workspace suggested by eclipse.
  2. Import the test project by doing the following:
    1. Under the File menu choose Import...
    2. Under General choose Existing Projects into Workspace and press Next
    3. Click the Select archive file radio button, and click the Browse... button.
    4. Navigate to your home directory (the file chooser is probably in the workspace directory).
    5. Select the file test2G.zip and click OK
    6. Click Finish.
  3. All of the files you need for this test should now appear in eclipse.

Java Standard Library Documentation

Java API


To submit your work

  1. Open a terminal. You will use this terminal to submit your work.
  2. Copy and paste the command cd eclipse-workspace/Test2G/src into the terminal and press enter.
  3. Type the following command and press enter to submit your work:

submit 2030 test2G SudokuRow.java


Question

Implement the SudokuRow class described by this API.

Make sure to read the documentation for the Digit class.

You do not have to include javadoc comments.

You are given a minimal set of unit tests. The tests are not at all exhaustive. Feel free to modify or add your own tests.

You are also given a main method. The main method should output the following:

r1                          : |?|?|?|?|?|?|?|?|?|

r2                          : |5|9|1|4|8|6|3|2|7|
r2.get(3)                   : 4
r2.isValid()                : true
r2.set(0, Digit.get(9))     : |9|9|1|4|8|6|3|2|7|
r2.isValid()                : false
r2.safeGetRow()             : [9, 9, 1, 4, 8, 6, 3, 2, 7]

r3                          : |?|9|1|4|8|6|3|2|?|
r3.solve()                  : |5|9|1|4|8|6|3|2|7|