(IntegerSet Class) Create class IntegerSet for which each object can hold integers in the range 0 through 100. Represent the set internally as a vector of bool values. Element a[i] is true if integer i is in the set. Element a[j] is false if integer j is not in the set. Member functions include
The default constructor: initializes a set to the so-called “empty set,” i.e., a set for which all elements contain false.
additional constructor: receives an array of integers and the size of that array and uses the array to initialize a set object.
unionOfSets: creates a third IntegerSet, as return value of the function, that is the union of two existing sets (i.e., an element of the result is set to true if that element is true in either or both of the existing sets, and an element of the result is set to false if that element is false in each of the existing sets).
intersectionOfSets: creates a third IntegerSet, as return value of the function, that is the intersection of two existing sets (i.e., an element of the result is set to false if that element is false in either or both of the existing sets, and an element of the result is set to true if that element is true in each of the existing sets).
insertElement: places a new integer k into a set by setting a[k] to true. Return void.
deleteElement: deletes integer m by setting a[m] to false. Return void.
printSet: prints a set as a list of numbers separated by spaces. Print only those elements that are present in the set (i.e., their position in the vector has a value of true). Print --- for an empty set. Return void.
isEqualTo: determines whether two sets are equal. Return bool.
Now write a driver program to test your IntegerSet class. Instantiate several IntegerSet objects.
Test that all your member functions work properly.
Additional requirements:
- Include your first name in output and screenshot.
- Add “const” to appropriate formal parameters, and member functions.
- State purpose, pre-conditions, and post-conditions for each function.
- Add proper comments to code.
- Check boundary and error conditions without crash.
- Turn in the following as separate files:
- IntergerSet.h: class declaration
- IntergerSet.cpp: class implementation
- testIntegerSet.cpp: driver program
- Screenshots of output