Question: Instructions Given Files collection.h Task 2 Write a class template, Collection, that stores an unordered collection of objects in an array along with the current
Instructions





Given Files
collection.h

Task 2 Write a class template, Collection, that stores an unordered collection of objects in an array along with the current size of the collection. Requirements Files collection.h collection_tests.cpp Makefile Class template class Collection; Member Functions collection(); The default constructor makes an empty Collection. Collection(const Collection&); ~Collection(); Collection& operator=(const Collection&); The Rule of Three copies and destroys Collections. size_t size() const; Input 1 Object is a generic type which is assumed to have a zero-parameter (default) constructor, an operators, and a copy constructor (and, therefore, also a destructor). None. Output The number of elements in the collection. Exceptions None. bool is_empty() const; Input None. Output Boolean true if and only if the collection is empty. Exceptions None. void make_empty(); Input None. Output None. Side effect: the collection is now empty. Exceptions None. void insert(const Object& obj); Input obj := the value to insert Output None. Side effect: the collection now contains the value of obj. Exceptions None. void remove (const Object& obj); Input None. Output None. Side effect: at most one element which has the same value as obj is removed. Exceptions None. bool contains(const Object& obj) const; Input None. Output Boolean true if and only if an object that is equal to obj is present in the collection. Exceptions None. Approved Includes cstddef, iostream, stdexcept, collection.h Tests You must submit a test suite that, when run, covers at least 90% of your code. Example Consider the following sequence of operations with post-conditions: 1. Make a new collection of ints a. A variable of type Collection int> exists. b. The collection is empty. CSCE 221 Spring 2022 2. Insert 8, 6, 7, 5, 3, 0, 9 a. The collection has 7 elements: {8,6,7,5,3,0, 9} b. The elements are the digits of Jenny's phone number 3. Remove 8 a. The collection has 6 elements: {6, 7, 5, 3, 0, 9} b. The collection is not empty 4. Make empty a. The collection is empty > > #ifndef COLLECTION_H #define COLLECTION_H #include template class Collection { // TODO( student): the rest of the template }; #endif // COLLECTION_H