Question: Write a class called IntegerS.et, which represents a mathematical s et of integer values. The IntegerS et will store the values in an array, which


Write a class called IntegerS.et, which represents a mathematical s et of integer values. The IntegerS et will store the values in an array, which will need to grow if it gets full. IntegerSet s hould have the following data members an int-pointer that points to a dynamically allocated array (of int) that holds the values that are part of the set . . an int that holds the current s ize of the array it will need to be updated whenever the add() method creates a larger array an int that holds the number of values that are currently part of the set - it will need to be updated in the add) and remove) methods . The IntegerSet class s hould have the following methods a default constructor that initializes the pointer data member to point to an array of size 10, initializes the variable that stores the size of the array to 10, 1 and initializes the variable that stores the number of values in the set to zerd a copy cons tructor that initializes the pointer data member to point to an array of the same size as the one being copied, copies over the array values, and als o copies the values for the size of the array and the number of values in the s et an overloaded assignment operator that initializes the pointer data member to point to an array of the same size as the one being copied, copies over the array values, copies the values for the size of the array and the number of values in the set, and returns a reference to the object pointed to by the this pointer a destructor that deallocates the dynamically allocated array the s ize() method s hould return the number of values currently in the the isEmpty) method s hould return true if the InteeerSet contains no values, the contains ) method s hould take an int parameter and return true if that the add) method should take an int parameter and add that value to the and return fals e otherwis e value is in the Integ erSet, but return fals e otherwis e Integ erSet (if that value is not already in the Inteeret) if the array is currently full and you need to add another value, then you must firs t increas e the size of the array by allocating a new array that is twice as large, copying the contents of the old array into the new array, redirec ting the data member pointer to the new array, and deallocating the old array (avoid memory leaks order matters) the remove() method should take an int parameter and remove it from the Integ erSet (if that value is in the Integeretby shifting over all of the subsequent elements of the array -it's okay if values that are no longer part of the set are still in the array, so long as you do the right bookkeeping the eetAsVestor method s hould return a vector (of ints) that contains all of the values in the IntegerS et and only those values. Order does n't matter Write a class called IntegerS.et, which represents a mathematical s et of integer values. The IntegerS et will store the values in an array, which will need to grow if it gets full. IntegerSet s hould have the following data members an int-pointer that points to a dynamically allocated array (of int) that holds the values that are part of the set . . an int that holds the current s ize of the array it will need to be updated whenever the add() method creates a larger array an int that holds the number of values that are currently part of the set - it will need to be updated in the add) and remove) methods . The IntegerSet class s hould have the following methods a default constructor that initializes the pointer data member to point to an array of size 10, initializes the variable that stores the size of the array to 10, 1 and initializes the variable that stores the number of values in the set to zerd a copy cons tructor that initializes the pointer data member to point to an array of the same size as the one being copied, copies over the array values, and als o copies the values for the size of the array and the number of values in the s et an overloaded assignment operator that initializes the pointer data member to point to an array of the same size as the one being copied, copies over the array values, copies the values for the size of the array and the number of values in the set, and returns a reference to the object pointed to by the this pointer a destructor that deallocates the dynamically allocated array the s ize() method s hould return the number of values currently in the the isEmpty) method s hould return true if the InteeerSet contains no values, the contains ) method s hould take an int parameter and return true if that the add) method should take an int parameter and add that value to the and return fals e otherwis e value is in the Integ erSet, but return fals e otherwis e Integ erSet (if that value is not already in the Inteeret) if the array is currently full and you need to add another value, then you must firs t increas e the size of the array by allocating a new array that is twice as large, copying the contents of the old array into the new array, redirec ting the data member pointer to the new array, and deallocating the old array (avoid memory leaks order matters) the remove() method should take an int parameter and remove it from the Integ erSet (if that value is in the Integeretby shifting over all of the subsequent elements of the array -it's okay if values that are no longer part of the set are still in the array, so long as you do the right bookkeeping the eetAsVestor method s hould return a vector (of ints) that contains all of the values in the IntegerS et and only those values. Order does n't matter
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
