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 file and .h file if you need it. Thanks
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
// Provides copy function #include // Provides assert function #include "bagi .h" using namespace std; namespace main_savitch_3 11:41 AM 100% const bag: size_type bag:CAPACITY bag::size type bag::erase(const value type& target) size type index-0; size type many_removed 0; while (index // Provides sizet namespace main savitch_3 class bag public 11:41 AM 100%- / TYPEDEFS and MEMBER CONSTANTS typedef int value_type; typedef std::size t size type static const size type CAPACITY 30; ICONSTRUCTOR bag) used 0 // MODIFICATION MEMBER FUNCTIONS size type erase(const value type& target); bool erase one(const value type& target); void insert(const value type& entry); void operator+(const bag& addend); I CONSTANT MEMBER FUNCTIONS size type size() const \ return used; ) size type count(const value type& target) const private store items used value_type data[CAPACITY]; II The array to size type used; // How much of array is // NONMEMBER FUNCTIONS for the bag class bag operator +(const bag& bl, const bag& b2); #endif bag.cpp # include #include "bagl.h" using namespace std; int set operation:search(int a].int sz,int n) AT&T LTE bag.cpp #include-iostream> #include "bagl.h" using namespace std; int set operation::search(int a[],int sz,int n) 11:42 AM e 100% for(int i-0;i>acount; cout>ai]; cout>bcount; cout>b[i]; ob.set union(a,b,acount,bcount) ob.set intersection(a,b,acount,bcount) ob.set difference(a.b,acount,bcount); Errors (from linux) bag.cpp:7:5: error: set_ operation has not been declared int set operation::search(int a[],int sz,int n) bag.cpp:25:6: error: set operation has not been declared void set operation::set union(int a],int b.int acount,int bcount) bag.cpp:53:6: error: set operation has not been declared void set operation:set intersection(int a],int bl.int acount,int bcount) bag.cpp:73:6: error: set operation has not been declared void set operation:set difference(int al].int b.int acount.int bcount) bag.cpp: In function int main() nt sz,int'n bag.cpp:25:6: error: set operation has not been declared void set operation::set union(int a,int bl.int acount,int bcount) bag.cpp:53:6: error: set operation has not been declared void set operation:set intersection int al.int bl.int acount,int bcount) bag.cpp:73:6: error: set operation has not been declared void set operation::set difference(int a[].int bl.int acount,int bcount) bag.cpp: In function int main() bag.cpp:97:1: error: set operation was not declared in this scope set operation ob; bag.cpp:97:15: error: expected ; before ob set operation ob bag.cpp:131:1: error: ob was not declared in this scope ob.set union(a,b,acount,bcount) bag.cpp:135:37: error: expected at end of input ob.set difference(a,b,acount,bcount)