SWE 619 Assignment 1
Spring 2013


Goal: Basic familiarity with contracts and Java.

For the first assignment, you'll build a very small piece of Java code:

   public static int lastDiff( int[] a, int[] b )
   // Precondition: a not null;
   //               b not null;
   //               There is some index i such that a[i] != b[i]
   //           
   // Postcondition: return the last index i at which a[i] != b[i]
   // E.g. lastDiff( [7, 13, 5, 4, 18], [7, 12, 5, 1, 18] ) = 3
Implement this method in a class called LastDiff. Note that error checking in lastDiff() for parameters that do not satisfy the precondtions is not necessary (or even permitted, if you happen to follow Meyer). We will discuss this point in detail in class when we cover exception handling.

Provide a decent set of JUnit tests.