Question: Design class IntegerSet. Each IntegerSet object can hold integers in the range 0..100. The set is represented by an array of booleans. Array element a[i]

Design class IntegerSet. Each IntegerSet object can hold integers in the range 0..100. The set is represented by an array of booleans. Array element a[i] is True is integer i is in the set and False otherwise. The default constructor initializes the array to the "empty set". Provide the following methods: Static method union that creates a set that is the set-theoretic union of two existing sets. Static method intersection that creates a set that is the set-theoretic intersection of two existing sets. Method insertElement inserts a new integer k into the set (by setting a[i] to True). Method deleteElement deletes an integer m (by setting a[i] to False). Method toString returns a string containing a set as a list of numbers separated by spaces. Include only those elements that are present in the set. Use "---" to represent an empty set. Method isEqualTo determines whether two sets are equal. Provide another class with main() method that all methods of class IntegerSet.

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!