Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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:
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 correctnessStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started