Question: I am supposed to do the following in Java: Introduction In mathematics, a set is a group of distinct items. Design and implement (using an

I am supposed to do the following in Java:

I am supposed to do the following in Java: Introduction In mathematics,

a set is a group of distinct items. Design and implement (using

Introduction In mathematics, a set is a group of distinct items. Design and implement (using an array) an ADT Set that supports the following operations: 1) +createSet() /I create an empty set 2) tisEmpty(): boolean (query) // determine whether a set is empty 3) +size(): integer fquery) //i.e., its cardinality 4) +add(in item: integer) // returns the number of elements in this set // adds the specified element to this set if it is not already //present 5) +contains (in item : integer): Boolean (query) //determines if this set contains the specified item 6) tunion (in other: Set) : Set // creates a new set containing all of the elements of this set and the other // set (no duplicates) and returns the resulting set 7) tintersection ( in other: Set): Set // creates a new set of elements that appear in both this set and the other set and returns the resulting set 8) Remove all of the items in the set // removes all the items in the set Implementation Details 1) Create an interface named Setlnterface including all eight methods. 2) Create a class named Set to implement the above interface. 3) Create a test class named test to verify your interfae ad class Set's correctness

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!