Question: Questions: a) Implement the method contains. b) Implement the method intersection. c) Draw the object referred to by the reference set. If you were to

Questions:
a) Implement the method contains. b) Implement the method intersection. c) Draw the object referred to by the reference set.
If you were to get these questions on a test and could not use a computer to answer this question, only pen and paper.
How would you answer them? Please explain in detail and with step-by-step on how to approach questions like these :)
The class Intset manages a set of integers: public class Intset elements in the set private int elements null assumption all elements in the argument array are unique public Intset int elements this .elements new int elements length for (int pos 0; pos elements .length; pos++ this elements [pos elements [pos to string returns a string representation of the set public String toString String if (elements length 0) S else for int pos 0; pos elements .length 1; pos++ s s elements pos s s elements elements length 11 "1"; return s contains returns true if the given element is a member of the set, and false otherwise. public boolean contains (int element) code is missing here intersection returns a set which contains the elements in the set that are also members of the given set public Int Set intersection (Intset set) code is missing here use the method contains Some instances of the class Intset are created and used like this: int numbers 19, 1, 4, 3, 7, 5 h; Intset set1 new Intset (numbers1); int numbers 2 (4, 2, 8, 5, 7); IntSet set2 new IntSet numbers System printin setl System out printin (set2) Intset Set setl .intersection (set2); print p (set) i When this code fragment is executed, the following printout is produced: 19, 1, 4, 3, 7, 5 (4, 2, 8, 5, 7 (4, 7, 5)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
