Question: Please use my code from the .cpp file and fix the Linux errors at the bottom. Provided are the prompt for this problem, the .cxx
PLEASE HURRY. Below is the prompt for this problem. Use the code for bag1.cxx, bagl.h and my code for bag.cpp. Also I have provided errors from linux for bag.cpp. Please use that code and fix my errors please. Thank you The goal of assignment 3 is to reinforce implementation of container class concepts in C++ Specifically, the assignment is to do problem 3.5 orn page 149 of the text. You need to implement the set operations union, intersection, and relative complement. Your code must implement the style guidelines of the author (preconditions, postconditions, class invariant, and function efficiencies). Your test program should use a unit test style -test each implemented function and clearly label your output. You will be provided with bag1.h and bagl.cpp files as reference. You will need to adapt this class to implement a set Here are some typical features of a set: 1. A set can have unique elements only-no duplicates allowed 2. Union of 2 sets sl E s2 = a new set with all elements from sl and s2 without any duplicates If sl {1,2,3), s2{3,4,5) then slEs2 -1,2,3.4,5) 3. Intersection of 2 sets s1s2-a new set with elements common to both sl and s2>3 AT&T LTE e 100% 11:41 AM 3. Intersection of 2 sets s1s2-a new set with elements common to both sl and s23 4. Relative complement of s to s2a new set with all elements from s1 that are not present in s2-,2) Here are the changes you should ideally be making to the .h and implementation files 1. Change the name of the class to set and rename the files to set.h and set.cpp 2. You will need to add new functions Union, Intersection and Relative complement, these will need to be non- member friend functions. 3. You should also add a function called contains that checks to see if an entry is already present in the set. It should return a boolean value This function should be a private function that can be called anytime, you need to insert an entry into a set (to make sure you don't add duplicate entries) 4. You do not need the following functions from the bag class a. Erase Count +overloaded function C. d. overloaded function 5. Do not add any more functions besides the ones listed under 2. & 3 6. Test the 3 set operations and clearly label your AT&T LTE bagl.cxx // FILE: bagl.cxx // CLASS IMPLEMENTED: bag (see bagl.h for documentation) // NVARIANT for the bag class: // 1. The number of items in the bag is in the member variable used; // 2. For an empty bag, we do not care what is stored in any of data; for a I/ non-empty bag the items in the bag are stored in data[0] through II data[used-1], and we don't care what's in the rest of data #include
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
