CS/SWE 332 Assignment 1
Due Wednesday, September 6, 2017

Goal: Basic familiarity with contracts and Java.

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

   public static int findDup (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 first index i at which a[i] == b[i]
   // E.g. findDup ([7, 13, 5], [5, 13, 5]) = 1
Implement this method in a class called FindDup. Although you should (obviously) test your implementation yourself, you do not need to include any test code. The GTA will test your code. Note that error checking in findDup() 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.

Update Aug-30 2017: To make sure you understand the point about preconditions, your code is required to be minimal. Specifically, if it possible to delete parts of your implementation and still have it satisfy the requirements, you'll earn less than full credit.

Grading Criteria: