Programming Assignment 2 solution
This assignment makes use of the files contained in this zip file.
This assignment is based on Programming Project 6 on page 170 of our textbook (but you don't need to follow any of the instructions given in that project).
In the zip file hw2.zip there is a Java file, IntArraySet.java and its Javadoc html file, IntArraySet.html. In this assignment you will complete the source file IntArraySet.java so that it implements the interface specified in IntArraySet.html.
The IntArraySet abstract data type is very similar to the IntArrayBag abstract data type (from Section 3.2 of the textbook), so quite a bit of the implementation of IntArraySet is very similar to the equivalent implementation of IntArrayBag. The main difference between the two data structures is that a set can contain only one instance of any particular number, but the bag data structure can contain an arbitrary number of copies of any particular number. Also, the set interface contains a few new methods that are not equivalent to any method from the bag's interface. These new methods implement the mathematical operations of set union, set intersection, and set subtraction.
In the zip file hw2.zip there is a Java file, TestIntArraySet.java that you can use to test your implementation of the IntArraySet abstract data type.
Turn in a zip file called CS275Hw2Surname.zip (where Surname is your last name) containing your version of IntArraySet.java.
You'll get 1 file (7.6KB)