Instruction: 1) Do not change the name of class. 2) Should write each line comments to explain your code. 3) Follow the guidelines we discussed in our class in submitting programming assignment when you submit via Bb. 4) We learned the arrayListType class in our classroom . You need to add/modify the member functions, removeAt(), removeALL(), max(), to the class arrayListType. 1. Write the definition of the implement ion of the three functions in the attached file. (A) The function removeAt of the class arrayListType removes an element from the list by shifting the elements of the list. However, if the element to be removed is at the beginning of the list and the list is fairly large, it could take a lot of computer time. Because the list elements are in no particular order, you could simply remove the element by swapping the last element of the list with the item to be removed and reducing the length of the list. Rewrite the definition of the function removeAt using this technique. Use the following function. declaration. void removeAt(int location); (B) The function remove of the class arrayListType removes only the first occurrence of an element. Add the function removeAll to the class arrayListType that would remove all occurrences of a given element. Also, write the definition of the function removeAll and a program to test this function. Use the following function declaration. void removeAll(const elemType& removeItem); (C) Add the function max to the class arrayListType to return the largest element of the list. Also, write the definition of the function max and a program to test this function. Use the following function declaration. elemType max() const; 2. Write a test program to perform the followings (see the output) (A) Create a default list (B) Insert six elements into the list. You need to prompt the user to get the elements. (C) Print the list (D) You need to prompt the user to have the position of element to be deleted. Then display the list after removing the element (E) You need to prompt the user to delete all occurrence elements to be deleted. Then display the list after removing them (F) Print a maximum value of the list after all tasks give to the above are complete.
Instruction: 1) Do not change the name of class. 2) Should write each line comments to explain your code. 3) Follow the guidelines we discussed in our class in submitting programming assignment when you submit via Bb. 4) We learned the arrayListType class in our classroom
. You need to add/modify the member functions, removeAt(), removeALL(), max(), to the class arrayListType.
1. Write the definition of the implement ion of the three functions in the attached file.
(A) The function removeAt of the class arrayListType removes an element from the list by shifting the elements of the list. However, if the element to be removed is at the beginning of the list and the list is fairly large, it could take a lot of computer time. Because the list elements are in no particular order, you could simply remove the element by swapping the last element of the list with the item to be removed and reducing the length of the list. Rewrite the definition of the function removeAt using this technique. Use the following function. declaration. void removeAt(int location);
(B) The function remove of the class arrayListType removes only the first occurrence of an element. Add the function removeAll to the class arrayListType that would remove all occurrences of a given element. Also, write the definition of the function removeAll and a program to test this function. Use the following function declaration. void removeAll(const elemType& removeItem);
(C) Add the function max to the class arrayListType to return the largest element of the list. Also, write the definition of the function max and a program to test this function. Use the following function declaration. elemType max() const;
2. Write a test program to perform the followings (see the output) (A) Create a default list
(B) Insert six elements into the list. You need to prompt the user to get the elements.
(C) Print the list
(D) You need to prompt the user to have the position of element to be deleted. Then display the list after removing the element
(E) You need to prompt the user to delete all occurrence elements to be deleted. Then display the list after removing them
(F) Print a maximum value of the list after all tasks give to the above are complete.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images