Question: Set Class Use the files: ArrayBag.h and ArrayBag.cpp to implement the Set class for integers as described in Chapter 1, Exercises 6 and 8 at

Set Class

Use the files: ArrayBag.hSet Class Use the files: ArrayBag.h and ArrayBag.cpp to implement the "Set"class for integers as described in Chapter 1, Exercises 6 and 8 and ArrayBag.cppat page 28. ArrayBag, makes an array ADT with many of the to implement the "Set" class for integers as described in Chapter 1, Exercises 6 and 8 at page 28. ArrayBag, makes an array ADT with many of the functions of a STL vector. Please use this NOT a vector. To verify your set class, write a main function that takes two sets of integers from an input file setInput.txt, and store them into separate sets, and apply following two operations.

First, combine the two into one set by overloading the + (union) operator, and print out the union set. The + operator must remove all duplicates and store one copy of any item. You also need to implement a subtraction operator (difference) where (A-B means removing all elements of B from A) and print out the result. So the main function takes two sets of integers and print the result of + and - operation.

A sample setInput.txtfunctions of a STL vector. Please use this NOT a vector. Toverify your set class, write a main function that takes two sets may look like this. Note that we assume the input file includes only two sets of integer numbers, each number is separated by white spaces and sets are separated by a newline character. 3 4 5 7 5 16 7 12 11 12 3 9 9 8 1 12 15 4 3 6 1 12 3 12 7 8 19 9 11 12 8 5 -4 -100

Validate that all inputs are integers. Anything else should be rejected with an error message. See validateInput.cppof integers from an input file setInput.txt, and store them into separate for an idea of how to validate input. After validating, instead of putting them into a vector, you might add them to a "Set" to meet this homework's requirement.

You should submit a single lastnameHW2.zip containing: ArrayBag.h, ArrayBag.cpp, main.cpp, SetFunctions.h, SetFunctions.cpp

sets, and apply following two operations. First, combine the two into onearraybag.h

set by overloading the + (union) operator, and print out the union

set. The + operator must remove all duplicates and store one copy

of any item. You also need to implement a subtraction operator (difference)arraybag.cpp

Need main.cpp and setfunctions.cpp and setfunctions.h to be built.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!