CS161 Assignment 3: Objects and ArrayLists



In this assignment you will write a class that stores and manages a collection of Rectangle objects using an ArrayList.
You will need to turn in two Java files, one containing your Rectangle class, and the second containing a class called RectangleCollection.

To hold the rectangles your RectangleCollection should have a private instance variable of type ArrayList that holds objects of class Rectangle. The RectangleCollection class that you are supposed to write needs have the following methods:


Submitting Your Assignment

Submit your Rectangle.java and RectangleCollection.java in a tarfile
using the checkin program as pa3.tar
You will learn the procedure to create a tar file in your recitation
Here are some of the commands that you will have to run in order to create pa3.tar file.

## Create a directory called PA3 using the command

mkdir PA3

## It will create PA3 under the current directory. You can get the current directory by using the command

pwd

## Suppose your Rectangle.java and RectangleCollection.java are in the directory /s/bach/a/john, copy those files to PA3 folder using

cp /s/bach/a/john/Rectangle.java PA3/

cp /s/bach/a/john/RectangleCollection.java PA3/

## Now run the following tar command to create a tar file

tar -cvf pa3.tar PA3

Now you are ready to submit pa3.tar using checkin program.


Note that your code should compile on department Linux machines, and make sure that you are submitting the source code rather than the Java class file.