Lab 4: Concept Review and Mini Project 0

Please report any errors directly to us:

A. Before You Start

B. Some Review

We'll start with some review exercises on the subjects of pointers and OOP:

C. Project 0

Take a look at the Mini Project 0 specification. Set up your working directory with its files in the usual way (see the instructions in the specification) if you're not sure how. Take particular care about the git push -u origin ... step, so that you don't end up trying to push to our repository instead of yours.

In the directory miniproj0, run make to compile the Java files. If you run java -ea cube.Main in miniproj0 directory, you will see a (broken) GUI open, which will be updated as you make progresses in your project. To see an example, run the following to see a working version.


Take some time to toy around with the example.

To give you a glimpse of a typical workflow for projects, do the following steps:

  1. Go to instructions in the specification, and follow the first 5 instructions, reading the code as instructed. When reading a java File, do not try to digest the whole problem from top to bottom. Instead, first read the name of the class and defined methods to understand a big picture of what it is and what it does. Then, move onto learning what each method does. If you find some keywords that you do not understand (e.g. framework-specific classes and method calls), do not hesitate to look up Java documentation to figure out and make a note to yourself for a future reference by adding explanatory comments.
  2. Execute make check to run the JUnit tests on your current code. All tests should fail now, but you will conquer each of them one by one.
  3. For, figure out what kinds of instance variables are required. There is no hard and fast rules to this step, but you should be able to infer most of them by understanding the initialize method.
  4. Based on your analysis, declare the instance variables that CubeModel requires. Then, immediately add and commit the changes you just made.

          git add
          git commit -m "[Proj0] Add instance variables to CubeModel."
  5. Implement the default constructor (without any parameters) in, initializing the necessary instance variables. Then, immediately add and commit the changes with a helpful and readable commit message.
  6. Repeat step 5 for side, cubeRow, cubeCol, moves, isPaintedSquare, and isPaintedFace. Make sure to add and commit the changes immedately for each method you implement.
  7. Run make check again to see if you pass any of the tests. checkCons0 and checkinit4 should pass. If not, make necessary changes until you pass those two tests. After the fix, remember to add and commit the changes.
  8. git push to save your work to the central repository.

There is nothing to submit for this lab.