The purpose of this assignment is to use MATLAB for implementing classes.
1. Sets (70 points)
Implement an abstract data type (class) "SET OF INTEGERS" with operation "UNION"
and "INTERSECTION". The name of your class should be called setIntegers.
The set constructor should accept a vector of integers or implement a method used to add
integers and update the set of integers property of your class.
2. Test Case (20 points)
Implement a script to test the Set class setIntegers. Look at the hint below. Also implement
a method called integerSet in the setIntegers class that prints out the sets of integers.
3. Comments and reports (10 points)
4. Bonus (10 points)
Write a function, called in your Test Case script that reads from a txt file containing two
columns of integers. Find the union and intersection of the two column of integers.
Hints: The intersection of two sets are those elements that belong to both sets.
The union of two sets are all the distinct elements from both sets.
>> a = setIntegers([1,2,3,5])
>> b = setIntegers([2,6,7])
>> a.union(b)
>> [1,2,3,5,6,7]
>> a.intersection(b)
>> [2]
>> a = setIntegers([1,3,5,7])
>> b = setIntegers([2,6,8])
>> a.union(b)
>> [1,2,3,5,6,7,8]
>> a.intersection(b)
>> []
>> a = setIntegers([1,3,5,7,1])
>> a.integerSet()
>> [1,3,5,7]