Due date: September 10th, 2013
- It will be graded based on design and correct implementation of the specifications.
- It is due on September 10th, 2013.
- Attach pseudocode
- Attach a flowchart. Here are some basic flowhcart symbols you need to know:
- Implement the driver/test class.
Create class IntegerSet. Each object of the class can hold integers in the range 0 through 100. A set is represented internally as an array of booleans. Array element a[i] is true if integer i is in the set. Array element a[j] is false if integer j is not in the set. The no-argument constructor initializes a set to the so-called “empty set” (i.e., a set whose array representation contains all false values).
Provide the following methods:
1. Method unionOfIntegerSets creates a third set which is the set-theoretic union of two existing sets (i.e., an element of the third set’s array is set to true if that element is true in either or both of the existing sets; otherwise, the element of the third set is set to false).
2. Method intersectionOfIntegerSets creates a third set which is the set-theoretic intersection of two existing sets i.e., an element of the third set’s array is set to false if that element is false in either or both of the existing sets; otherwise, the element of the thirds set is set to true).
3. Method insertElement inserts a new integer k into a set (by setting a[k] to true).
4. Method deleteElement deletes integer m (by setting a[m] to false).
5. Method setPrint prints a set as a list of numbers separated by spaces. Print only those elements that are present in the set. Print — for an empty set.
6. Method isEqualTo determines if two sets are equal.
Write a program to test your IntegerSet class. Instantiate several IntegerSet objects. Test that all your methods work properly.