Answered step by step
Verified Expert Solution
Question
1 Approved Answer
DRIVER.CPP Make the necessary modification to Driver.cpp in order to call the modified Movies constructor MOVIES CLASS MODIFICATION ARRAY CHANGED TO LINKED LIST Change your
DRIVER.CPP Make the necessary modification to Driver.cpp in order to call the modified Movies constructor MOVIES CLASS MODIFICATION ARRAY CHANGED TO LINKED LIST Change your Movies.cpp & Movies.h files so that you no longer create an array of Movie pointers. Instead, you will create a LinkedList of Movie pointers. You will only have one attribute-the linked list object which will hold Movie pointers The constructor/destructor will need to change due to the change in attributes You will no longer need the following functions: getMaxMovies(), getMoviesArray), getAMovieFromArrayl, and resizeMovieArray(). You should also rename any functions to say "List" instead of "Array so that it makes more sense. You should also modify all functions that refer to the array and change it to the linked list. You will create two new functions insertionSort-This function should sort the LinkedList of Movies in ascending order by Movie title. This function will call a function called swap in the linkedList class to swap values in the linked list when necessary. Use the insertion sort algorithm to implement this function. o o binarysearch This function should search for a particular movie title to see if it is in the list. It should return -1 if the Movie title could not be found. Remember that Movie titles are of data type Text. Use the binary search algorithm to implement this function. The addMovieToList function will need to be modified so that after this function gets the title of the movie from the user, it will check to see if this movie is already in the library (by clling binarySearch function). If the title is not in the library, then the function will proceed to get the other movie information from the user and then add this movie to the linked list. Then, it will call the insertionsSort function so that the movies are put in ascending order by title. o If the title is in the library then no other information will be asked from the user and the program will print "T'm sorry! [movie title] is already in in your movie library so it will not be added again. o The readMoviesFrom File function will need to be modified so that after this function reads one movie's data from the file, it will check to see if this movie is already in the library (bylling binarysearch function). If the title is not in the library, then the function will add this movie to the linked list. Then, it will call the insertionSort function so that the movies are put in ascending order by title. o If the title is in the library then the program will print "[movie title] was not added because it was already in the movie library." Then it will release the memory for the three Text objects that were unnecessarily created. o The getNumMovies function will need to be modified to return the number of nodes in the linked list. LINKEDLIST MODIFICATION Add a function to the LinkedList template class (LinkedList.h) called swap. This function should accept two integers which represent two node positions that need to be swapped. This function should swap the VALUES in the two nodes. You do not have to swap the whole node, just swap the values
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started