hello , can anybody help me write this program?
I am expected to create the following classes:
• Set<T>: Set.h
“Set” is a template class that represents a set in mathematics. A set in this homework can only contain
items of same type. In other words, if a set is a “set of integers” it cannot contain “char”s, “float”s or
“double”s etc.
Methods
• void add(const T& item)throw(SetException) Adds an item to the set. Throws an instance of “Se-
tException” class if the “item” already exists. Error code is “ITEM ALREADY EXISTS”, and
message is “Item already exists”.
• void remove(const T& item)throw(SetException) Removes an item from the set. Throws an instance
of “SetException” class if the “item” does not exists. Error code is “ITEM NOT EXISTS”, and
message is “Item does not exist”.
• bool exists(const T& item)const Returns true if an item exists in the set, returns false otherwise.
• int cardinality()const Returns the number of elements in the set.
• std::vector<T> toSortedVector()const Returns the set as an std::vector with items sorted in in-
creasing order.
thannks
I am only alllowed to use STL algorithms and not allowed to use STL “Set” class!