In this lab, you will practice manipulating two dimensional arrays, writing JUnit tests, and submitting assignments through Web-CAT.
Once all of your methods are implemented and tested, submit your finished work through Web-CAT. Web-CAT will not perform any style checking, but it will run both sets of unit tests on your code: yours and the instructor's. In order to receive full credit on the assignment you must:
Array2D.java
.
You can find submission instructions on this page: Help Submitting Assignments Using Web-CAT .
Your login should be the first part of your JMU email address, and your password will be your student ID number (unless you have an existing Web-CAT account). I encourage you to pick a more convenient password.
isRowValid
:
double[][] data = {{}, {1}, null, {2, 3}}; System.out.println(Array2D.isRowValid(data, -1)); System.out.println(Array2D.isRowValid(data, 0)); System.out.println(Array2D.isRowValid(data, 1)); System.out.println(Array2D.isRowValid(data, 2)); System.out.println(Array2D.isRowValid(data, 3)); System.out.println(Array2D.isRowValid(data, 4));What do you expect will be printed in each case?
Array2D
class in this calculation. In other words,
you will lose points if you never instantiate an object of type
Array2D
, even though it doesn't make sense to instantiate an object of
type Array2D
. You can deal with this problem by including the
following statement in one of your tests.
Array2D t = new Array2D();
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 next week.