Question: Part 1: Starting from the arrayListType.h (attached with this assignment) and without using any of the predefined member functions, Write the required code to do
Part 1: Starting from the arrayListType.h (attached with this assignment) and without using any of the predefined member functions, Write the required code to do the following: 1. Modify the arrayListType by adding a member function that increase each element in the list by a constant number that it takes as a parameter. This member function does not return any value. For example, if the list L contains the elements 2,1,3,4,5,3,0 and you call the member function as in LincrementByConstant(3); 1 The list content will then be changed to 5,4,6,7,8,6,3 Fitndef ARRAY_LIST_TYPE #define ARRAY_LIST_TYPE #include class arrayList Type { public: const arrayListType & operator - (const arrayListType & ); I/Overloads the assignment operator bool isEmpty() const; //Function to determine whether the list is empty 1/Postcondition: Returns true if the list is empty: // otherwise, returns false. bool isFull() const; //Function to determine whether the list is full. 1/Postcondition: Returns true if the list is full; // otherwise, returns false. int listSize() const; 1/Function to determine the number of elements in the list 1/Postcondition: Returns the value of length. int maxListSize() const; //Function to determine the size of the list. 7/Postcondition: Returns the value of maxSize. void print() const: //Function to output the elements of the list //Postcondition: Elenents of the list are output on the // standard output device. bool isItemAtEqual(int Location const elen Type, & iten) const; //Function to determine whether the item is the same 1/as the item in the list at the position specified by //Postcondition: Returns true if list(location] // is the same as the item; otherwise, 1/ returns false. void insertAt(int location.const elen Type & insertIten); //Function to insert an item in the list at the //position specified by location. The item to be inserted 1/is passed as a parameter to the function. 1/Postcondition: Starting at location, the elements of the // list are shifted down, List[location) - insertItem. 7/ and length. If the list is full or location is // out of range, an appropriate message is displayed. void insertEndi const Klen Type, & insert Item): //Function to insert an iten at the end of the list. //The paraneter insertIten specifies the item to be inserted. /Postcondition: list length - insertIten; and length+++ // If the list is full, an appropriate message is Il displayed void renoveAt(int location); //Function to remove the item from the list at the 1/position specified by location //Postcondition: The list element at list[location is removed 17 and length is decresented by 1. If location is out of 1/ range, an appropriate message is displayed. void retrieveAt(int location, le type retItem) sont //Function to retrieve the riche void retrieveAt(int location, slemtype, & retIten) const; //Function to retrieve the element from the list at the //position specified by location. //Postcondition: retItem-list(location) // It location is out of range, an appropriate message is // displayed. void replaceAt(int location constelen type & repiten): //Function to replace the elements in the list at the 1/position specified by location. The item to be replaced // is specified by the parameter repitem. 7/Postcondition: list[location) - repItem // If location is out of range, an appropriate message is // displayed. void clearlist(); //Function to remove all the elements from the list. //After this operation, the size of the list is zero. 1/Postcondition: length = 0; int segSearch(const elen Type & item) const; //Function to search the list for a given iten. 1/ Postcondition: If the item is found, returns the location // in the array where the item is found; otherwise, // returns -1. void insert(const elemType, & insertItem): //Function to insert the item specified by the parameter //insertItem at the end of the list. However, first the //list is searched to see whether the item to be inserted 1/is already in the list. //Postcondition: list[length) - insertItem and length++ // If the item is already in the list or the list // is full, an appropriate message is displayed. void remove(const slem Tyre & removeItem); //Function to remove an item fron the list. The parameter /removeItem specifies the item to be removed. V/Postcondition: If renoveItem is found in the list, // it is removed from the list and length is // decremented by one. arrayListType(int size = 100): //constructor //Creates an array of the size specified by the //parameter size. The default array size is 100. 7/Postcondition: The list points to the array, length = 0, // and saxSize = size arrayListType(const arrayListType & otherList): //copy constructor arrayListType(): //destructor 1/Deallocates the memory occupied by the array. protected: AlemType.. list; //array to hold the list elements int length; //to store the length of the list int maxSize: //to store the maximum size of the list template tisEspty() const ( return (length=0); 1 tenplate bool arrayList Type isFull() const { return (length == maxSize): 1 template ::listSize() const { return length: > template int arrayListType :: maxListSize() const { return maxSize: > template void arrayListType print() const { for (int i = 0; i bool arrayListType sisitentEqual(int location, const cleType 6 iten) const { 11 (location length) { certo "The position of the iten e "15 out of range" length) ser c "The position of the item to be inserted o is out of range and else if I length > maxSize) //list is full cert "Cannot insert in a full list" Location 1) list-listli - 1); /ove the elements down list location) - Insertites; //insert the iter at the 1/specified position Length: //inchement the length > Ilend insertat template Ilend insertEnd template void arrayList Type : removeAt(int location) { if (location length) ACC > //end removeAt template void arrayListType retrieveAt(int location, elemType & retItem) const { if (location = length) cerc. void arrayListType replaceAt(int location, const sien Type, & repiten) if (tocation length) cerr void arrayListType Clentype > 11 clearlist() { length = 0; > /end clearlist template Yuttype Splentype> arrayListTypefint size) { ser "The array size must be positive. Creating " arrayListType R TarrayListType() { deletel list; 3 template arrayListtype SSLYDR arrayListType(const arrayListType 6 otherlist) { Length other it.length; list-newsletypelma Sizel: Il create the array assertist - NULL); //terminate if unable to allocate //memory space for (int 1-1 arrayListTypelen Type 11 operator (const arrayListType 6 otherlist) template const arrayListType & arrayListType :: operator = (const arrayListType & otherList) { if (this 1- & otherList) 7/avoid self-assignment deletel) list: maxSize = otherList, naxSize; length = otherList. length: list = new elen Type ImaxSize): //create the array assert(list = NULL); //1f unable to allocate memory //space, terminate the program for (int i = 0; i int arrayListType Ilend sesSearch template void arrayListType > Ilend insert template tsrenove(const slentype removeItem) { int loc: if (length = 0) Kerr, "Cannot delete from an empty list."