Question: Homework Assignment #1 Warm-up Mathematical review Write a computer program that defines the class Set (assume that the elements are integers). The program tha class

 Homework Assignment #1 Warm-up Mathematical review Write a computer program that

Homework Assignment #1 Warm-up Mathematical review Write a computer program that defines the class "Set" (assume that the elements are integers). The program tha class "Set". ciSE students class should contain methods to perform the operations listed below. Write a test t tests your "Set" class. The test program will be a menu-like to test all the operations in will do parts: a, b, e, d. g. and o only. fferent constructors to initialize the set (one is to set the elements from a one dimension array) union: find the union of the set with a given set. oUTPUT/RETURN: a Set object. c) intersection: find the intersection of the set with a given set. oUTPUT/RETURN: a Set object. b) d) difference: find the difference of the set and the given set (Set- given Set). OUTPUT/RETURN: a Set object e) Cartesian product: find the Cartesian product (Set X given set). OUTPUT: prints out the product. f) Check whether the set is a subset of another set. OUTPUT/RETURN: True or False 8) isEmpty method that returns true if the set is empty (no elements). h) isElement method that takes an element and check if it is an element of the set. i) j) k) isEqual method that check if the set is equal to a given set. getCardinality method that returns the cardinality of the set. addElement method that adds an element to the set. Make sure that you don't add an existing element. You will use isElement check before you try to add it. I) removeElement method to remove an element from the set m) Clear method to remove all elements of the set. n) toArray that converts the object of the Set class to a one dimensional array. o) print method to print the elements of the set. In your test program, declare two sets objects and use the constructor to initialize them by sending a one dimension array contains the elements of the set. Instructions 1. You can use C#, python 3.x, C++, Perl, or Java programming languages. No other language is allowed or accepted. 2. All of the work should be submitted as a softcopy. No hardcopy will be accepted. 3. Q1 should be submitted as source code file in separate file. Name the file as q1. Example: q1.cpp or qi.java 4. Put all source files in one folder and name it as LASTNAME_HW1. Compress this folder and submit it through elearn

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!