Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I only need the IntegerSet.h file and IntegerSet.cpp file, thank you! For this programming assignment you will be creating a class named IntegerSet for which
I only need the IntegerSet.h file and IntegerSet.cpp file, thank you!
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 alil is true if integer i is in the set. Element ali] is false if integer j is 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. 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). b. Provide an insertElement member function that places a new integer k in to a set by setting a[k] to true. Provide a deleteElement member function that deletes integer m by setting a[m] 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 isEquaITo 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 objectStep 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