Lab 2

Due Friday, 9/2 - 11:59pm

    1. Write a for loop to print the multiples of 3 from 300 down to 3.
    2. Implement a class Square. A Square represents the information about a single square of a Sudoku board. A Square has the following data members, and get/set methods for each data member:
      1. original - a variable of type boolean to indicate whether the value was set in the original puzzle
      2. set - a variable of type boolean to indicate whether the value has been set by the user, or was set in the original puzzle
      3. value - a variable of type int to indicate the value stored in the square. if the square has not been set, the value will be 0.
    3. Implement a class Board that has a 9x9 array of Squares as its data member. Implement a method checkRows in the Board class. checkRows returns true if every row in the array contains a square with each value 1-9. For testing, statically set the values stored in each Square of the array. The signature of the checkRows method is as follows:
    • public boolean checkRows();

I have created the following skeleton for the Board class to get you started: Board.java. This contains two helper methods to initialize the board with some test data.

Please submit your work in an SVN directory: https://www.cs.usfca.edu/svn/<username>/cs112/lab2

Submission Instructions