Write a computer program that definesthe class “Set” (assume that the elements are integers).

Q1) Write a computer program that definesthe class “Set” (assume that the elements are integers).
Theclassshouldcontainmethodstoperformtheoperationslistedbelow. Writeatest programthattests
your“Set”class.Thetestprogramwillbeamenu-liketotestalltheoperationsin class “Set” . .
• Differentconstructorstoinitializetheset(oneistosettheelementsfromaone
dimension array)
• union:find the union ofthe set with a given set. OUTPUT/RETURN: a Set object.
• intersection:findtheintersectionofthesetwithagivenset.OUTPUT/RETURN:aSet
object.
• difference:find the difference ofthe set and the given set(Set – given Set).
OUTPUT/RETURN: a Set object.
• Cartesianproduct:findtheCartesianproduct(SetXgivenset).OUTPUT:printsoutthe
product.
• Checkwhetherthe setis a subset of anotherset.OUTPUT/RETURN:TrueorFalse.
• isEmpty method that returnstrue ifthe set is empty (no elements).
• isElement method that takes an element and check ifit is an element ofthe set.
• isEqual method that check if the set is equal to a given set.
• getCardinality method that returnsthe cardinality of the set.
• addElementmethodthataddsanelementtotheset.Makesurethatyoudon’taddan
existing element. You will use isElement check before you try to add it.
• removeElement method to remove an element from the set.
• Clear method to remove all elements of the set.
• toArray that convertsthe object ofthe Set classto a one dimensional array.
• print method to print the elements of the set.
Inyourtestprogram,declaretwosetsobjectsandusetheconstructortoinitializethembysendinga
one dimension array contains the elements of the set.
Instructions:
• YoucanuseC#,Python3.x,C++,Perl,orJavaprogramminglanguages.Noother
languageisallowed or accepted.
• All ofthe work should be submitted as a softcopy.