SWE 619 Assignment 1
Fall 2017


There are two parts to this assignment.
  1. Post a brief intro about yourself on the course Piazza page. For any credit, the posting must:
  2. Consider the following specification:
       public static int findPrimeFactor (List<Integer> a, List<Integer> b)
       // Requires: a not null; b not null;
       //           there is some index i where b[i] is 
       //           both prime and a factor of a[i]
       // Effects: return the least index
       //          at which b[i] is a prime factor of a[i]
       // E.g. findPrimeFactor ([12, 25, 18, 8], [6, 2, 3, 2]) = 2
       // (Note: 6 is a factor of 12, but is not prime,
       //  and 2 is prime, but is not a factor of 25.  However,
       //  3 is a prime factor of 18. Hence, index "2" is the correct
       //  answer.  index "3" is not a possible answer, because the
       //  third index is not the least index with the desired property.)
       // Also note that a[] and b[] need not be of the same length.
    Implement this method in a class called FindPrimeFactor. 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 findPrimeFactor() 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: