Two-Dimensional Arrays

The goal of this lab is to gain experience working with two-dimensional arrays.

Instructions

  1. Create a new Eclipse project. Download and import the files Array2D.java and Array2DTest.java.
  2. After importing, there will be compilation errors in Array2DTest.java. This file won't compile until the JUnit package is added to the project build path. The easiest way to accomplish this is to hover your mouse over the line:
    import static org.junit.Assert.*;
    
    at the top of Array2DTest.java. This should bring up a menu with the option, "Fix project setup...". Select this option and select OK. At this point you should be able to execute the JUnit tests by right clicking Array2DTest.java and selecting Run as -> JUnit Test.
  3. Complete the unfinished methods in Array2D.java according to the provided JavaDoc comments.
  4. Once all of your methods are implemented and tested, submit your finished work through Web-CAT. Web-CAT will not perform any style checking for this lab. There is no limit on the number of submissions.

Notice that the methods in Array2D.java use a return value of Double.MIN_VALUE to indicate an error condition. It would make more sense to throw an exception. Never fear! We will start working with exceptions soon.