Lab 2. OOP and List
CS203, Spring 2006



1. (30pt)  Complete all the methods in ArrayList class, which implements the List interface. Keep the code clean and simple, and remember to handle possible erroneous input.

2. (15pt)  Write a program ListTest.java to test the methods you implemented in ArrayList. Design your tests carefully to cover as many cases (including cases with erroneous input) as possible, without going overboard.

3. (20pt)  Given class Shape, complete classes Point, Triangle, and Rectangle. Note that the distance between two points (x1,y1) and (x2,y2) is sqrt((x1-x2)^2+(y1-y2)^2), and the area of a triangle is sqrt(s*(s-a)*(s-b)*(s-c)), where a, b, and c are the lengths of the three sides, and s is (a+b+c)/2.

4. (5pt)  Write a program Area.java which performs the following operations (in the specified order):
(10pt) Use comments to indicate which part(s) of the code uses polymorphism and/or dynamic dispatching.

5. Turn in all the source code files through CSNS.