Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

***********************USE C# PROGRAMMING LANGUAGE******** Please read carefully ********* Write a computer program that defines the class Set (assume that the elements are integers). The class

***********************USE C# PROGRAMMING LANGUAGE******** Please read carefully *********

Write a computer program that defines the class Set (assume that the elements are integers). The class should contain methods to perform the operations listed below. Write a test program that tests your Set class. The test program will be a menu-like to test all the operations in class Set a) Different constructors to initialize the set (one is to set the elements from a one dimension array) b) 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. 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. g) 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) isEqual method that check if the set is equal to a given set. j) getCardinality method that returns the cardinality of the set. k) addElement method that adds an element to the set. Make sure that you dont add an existing element. You will use isElement check before you try to add it. l) 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.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Graph Databases New Opportunities For Connected Data

Authors: Ian Robinson, Jim Webber, Emil Eifrem

2nd Edition

1491930896, 978-1491930892

More Books

Students also viewed these Databases questions