Create and test a set class to represent a classical set


Create and test a Set class to represent a classical set. Your sets should support the following methods:

Set(elements) Create a set (elements is the initial list of items in the set).

addElement(x) Adds x to the set.

deleteElement(x) Removes x from the set, if present. If x is not in the set, the set is left unchanged.

member(x) Returns true if x is in the set and false otherwise.

intersection(set2) Returns a new set containing just those elements that are common to this set and set2.

union(set2) Returns a new set containing all of elements that are in this set, set2, or both.

subtract(set2) Returns a new set containing all the elements of this set that are not in set2.

Request for Solution File

Ask an Expert for Answer!!
Basic Computer Science: Create and test a set class to represent a classical set
Reference No:- TGS01707733

Expected delivery within 24 Hours