This assignment makes use of the files contained in this zip file. This assignment is due Tuesday, September 27.
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). This assignment is also based on the IntBag
example from the Chapter 3 code folder.
In the zip file hw2.zip
there is an abstract base class, IntSet.java
and its Javadoc html file, IntSet.html
. Also in the zip file there is a class IntArraySet.java
that should implement IntSet.java
. In this assignment you will complete the source file IntArraySet.java
so that it implements the interface specified in IntSet.java
, IntSet.html
, and IntArraySet.html
.
The IntSet
abstract data type is very similar to the IntBag
abstract data type (from Section 3.2 of the textbook), so quite a bit of the implementation of IntArraySet
is 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 IntArraySet
.
Turn in a zip file called CS275Hw2Surname.zip
(where Surname
is your last name) containing your version of IntArraySet.java
.
This assignment is due Tuesday, September 27.