CPSC 170 Sub Post Lab 2
ArrayList
Due Before Class on Friday, January 28th

The post lab 2 assignment involves storing an unknown number of objects in a list. This is similar to the CDCollection class from last semester where the array needs to be able to expand to fit more objects if neccessary. Instead of rewriting classes that store objects in expanding arrays every time we need one, we are going to take advantage of inheritance to write one class that works with any class. We can do this by creating a class that manages an array of Objects, which all classes are descendents of. The file ArrayList.java contains an outline for such a class. It has an array of Objects for an instance variable, a constructor that initializes an empty list, a method that adds an object to the list, a method to get objects in the list, a method to get the number of objects in the list, and a toString method. Complete the methods as specified in the method comments. Use the JUnit testing file ArrayListTest.java to test your code.

Submission: Tar and submit your code on the course Inquire site.