Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Need two files. integerSet.h and integerSet.cpp When tested, the output should be exactly like this (This is assign8.cpp this should not be modified at all)
Need two files. integerSet.h and integerSet.cpp
When tested, the output should be exactly like this
(This is assign8.cpp this should not be modified at all)
#include #include "IntegerSet.h" // IntegerSet class definition using namespace std;
int main() { IntegerSet a; IntegerSet b; IntegerSet c; IntegerSet d;
cout
if ( a.isEqualTo( b ) ) cout
cout
cout
const int arraySize = 10; int intArray[ arraySize ] = { 25, 67, 2, 9, 99, 105, 45, -5, 100, 1 }; IntegerSet e( intArray, arraySize );
cout
cout
system("PAUSE"); return 0; } // end main
For this programming assignment you will be creating a class named 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 ali is true if integer i is in the set. Element alil is false if integer jis not in the set. The default constructor initializes a set to the so-called "empty set," i.e., a set for which all elements contain false. Provide member functions for the common set operations. For example, provide a unionOfSets member function that creates a third set that is the set-theoretic 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). a. b. Provide an intersectionOfSets member function which creates a third set which is the set-theoretic 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). Provide an insertElement member function that places a new integer k in to a set by setting alk] to true. Provide a deleteElement member function that deletes integer m by setting alm] to false c. Provide a printSet member function that 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 d. e. Provide an isEqualTo member function that determines whether two sets are equal. Provide an additional constructor that receives an array of integers and the size of that array and uses the array to initialize a set object. fStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started