$30
You will implement the Set class. It implements SetInterface . breakdown of the points. Read the doc comments for each method in SetInterface
carefully. In addition to the interface methods, you will also need to make some constructors, as detailed below.
• It will store its data in an array.
• It will be dynamic capacity (like we talked about in Lecture 3).
• The Set(int) constructor will initialize the array to the given capacity.
◦ It will check for an illegal capacity, and throw IllegalArgumentException in that case.
• The Set() constructor will initialize the array to a reasonable default capacity.
◦ Reusing methods/constructors is a great habit! See section D.10 of Carrano (page 877 in the 4th edition) for details.
• The Set(E[]) constructor will initialize the set to contain the items in the array.
◦ You will not make this array into the set’s backing array. That violates encapsulation.
◦ The array may contain duplicates and null s. You should ignore these instead of throwing an exception.
• Although you are given SetFullException , your add method will never actually throw it.
◦ Since your implementation will dynamically resize its capacity, it can never be “full.”
MovieShelf [30 points]
You will implement the MovieShelf class. It implements MovieShelfInterface . Again, read the doc comments in that file carefully.
MovieShelf is a client of your Set . That is, it will have an instance You are writing code that of Set and use it to hold its data. This means you are creating this uses your own code. We class via composition. call this “eating our own dogfood”. It’s kind of a gross
Details of your MovieShelf implementation term, but hey.
• It will store its data in a Set<MovieShelfItem .
• The MovieShelf() constructor will initialize that Set to be empty.
• The MovieShelf(Movie[]) constructor will initialize that Set with that array of Movie s.
A note on printAll() : you can use Set.toArray() to get the movies to print, but it is an