Create a class called ''Set'' in C++ using object-oriented techniques
$30-5000 USD
Paid on delivery
NO.1)Create a class called "Set". The max of elements in a Set is 100. Create the array to store the elements using the "new" operator. The only elements can be stored in a Set is an integer. Define objects of Set class as following examples: int a[11]={10,0,1,2,3,4,5,6,7,8,9}; int b[6]={5,1,3,5,7,9}; int c[6]={5,0,2,4,6,8}; int d[3]={2,0,1}; int e[1]={0}; Set Nnatural ; Set one_digit=a; Set odd=b; Set even=c; Set zero=0; Set zero_one=d; Set x=one_digit; Set empty_set2=e; 1. Write constructors (and a destructor) for above operations. 2. Write following functions: Insert Remove Is_empty Card 3. Overload following operators: = : Assignment operation (between 2 sets) + : Union of two sets * : Intersection of two sets - : Difference of two sets = = : Equality of two sets, if all members are same return 1, else 0 [] : Membership of an element to a set < : Subset operator < : Superset operator << : Output a set. Elements will be separated by a blank and an end of line at the end. >> : Input a set. Elements will be separated by a blank until end of line. NO.2)Create a class called "Bag". The Bag class will be a subclass of the class Set. In a Bag the same element can be repeated any number of times. Acordingly some existing Set functions should be redefined in a Bag class. The max of elements in a Bag is 1000. Create the array to store the elements using the "new" operator. The elements can be stored in a Bag is an integer. Bag objects can be constructed in different ways: int a[4]={1,2,3,4}; int b[10]={0,0,0,1,1,2,3,8,9,9}; int c[]={0,1,1,8,9}; int d[]={0,0,8}; Bag empty_bag; Bag bag1(b,10); Set set1(a,4); Bag bag2=bag1; Bag bag3=set1; Bag bag4(c,5); Bag bag5(d,3); 1. Write constructors for above declarations. 2. Inherit functions/operator from Set Class. 3. Add the following functions: sum : find the sum of the integers in a bag product: find the product of the integers in a bag 4. Define the following function: void test(Set & ps1, Set & ps2) { Bag tb(ps1); int i; cout<<ps1<<ps2<<tb; ps1=ps2+ps2; cout<<ps1; cin>>ps2; tb=ps2; cout<<tb; cin>>i; cout<<tb[i]; } *** SEE ATTACHMENT FILE FOR DETAIL OUTLINE! ***
## Deliverables
Complete and fully-functional working program(s) in executable form as well as complete source code of all work done. Program must be fully comment. Complete copyrights to all work purchased. Due March 18, 2002. 12:00PM(Noon) Eastern Time *** SEE ATTACHMENT FILE FOR DETAIL OUTLINE! ***
## Platform
Program must be written in C++ using object-oriented techniques. Program must be able to be compiled and executed on Borland C++ version 5.02 Due March 18, 2002. 12:00PM(Noon) Eastern Time *** SEE ATTACHMENT FILE FOR DETAIL OUTLINE! ***
## Deadline information
Program Due March 18, Monday 12:00PM(Noon) Eastern Time *** SEE ATTACHMENT FILE FOR DETAIL OUTLINE! ***
Project ID: #2842085