All code should be in C++ Using the UnsortedList class (UnsortedList.h file below) write a function sublist which extracts elements that are smaller than a given item from the given list and forms a new list. The precondition of the function is: the list has been initialized and is not empty. The postconditions are: newList contains all the items of the list whose values are less than the given item. Implement the sublist function as a friend function of the UnsortedList class whose declaration is: friend void sublist(const UnsortedList& list, const ItemType& item, UnsortedList& newList); (Hint: The UnsortedList class has private members ItemType list[MAX_LENGTH]; int length; and the member functions getLength, resetList, insert, remove, etc.) //********************************************************** // SPECIFICATION FILE (UnsortedList.h) // This file gives the specification of a basic class // template for unsorted array-based lists. // The list components are not assumed to be in order by // value. //********************************************************** #ifndef UNSORTEDLIST_H #define UNSORTEDLIST_H #include #include // Needed for the exit function using namespace std; const int MAX_LENGTH = 100; // Maximum number of components template // You may also choose to use // typedef statement class UnsortedList { public: // Constructor UnsortedList(); // Post: Empty list has been created. length has been set to zero. // Knowledge responsibilities int getLength() const; // Post: Returns the length of the list bool isEmpty() const; // Post: Returns true if list is empty; false otherwise bool isFull() const; // Post: Returns true if list is full; false otherwise bool isInList(const ItemType& item) const; // Post: Returns true if item is int the list; false otherwise int seqSearch(const ItemType& item) const; // Function to search the list for a given item. // Post: If item is found, returns the index in the array where // item is found; otherwise, return -1. // Action Responsibilities void resetList(); // Post: The list becomes empty. length has been set to zero. void insert(const ItemType& item); // Function to insert item to the end of the list. However, first // the list is searched to see whether the item to be inserted is // already in the list. // Post: list[length] = item and length++. If item is already in // the list or the list is already full, an appropriate message is // displayed. void remove(const ItemType& item); // Function to remove item from the list. // Post: If item is found in the list, it is removed from the list // and length is decremented by one. // Overloaded [] operator declaration. // This function returns a reference to the element in the // array indexed by index. ItemType& operator[](const int& index); // Additional operations void sort(); // Post: list items have been put into ascending order by selection sort void selectionSort(); // Function to sort the items in the list. // Post: list items have been put int.