Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

On the last part of the project, you\'ll add searching and sorting functionaliti

ID: 3712873 • Letter: O

Question

On the last part of the project, you'll add searching and sorting functionalities to the MovieApp. MovieApp.java contains all the methods you need to implement. Refer to the methods description on file for your implementation. Fill in the code in the following methods and submit MovieApp.java:

searchMovieByName: search a movie by name using the iterative binary search algorithm. Assume a sorted array.

searchMovieByName: search a movie by name recursively. Assume an unsorted array.

sortByYear: sort the array of movies by year using the insertion sort algorithm.

sortByName: sorts the array of movies by name using the selection sort algorithm.

We provide the files here : http://www.research.cs.rutgers.edu/~anapaula/cs111/cs111MovieApp2.zip

IO.java: the IO class

Movie.java: the Movie class from the first part of the project

MovieApp.java: the application file with the methods from the second part of the project and the methods you are to update and submit

MovieDriver.java: a driver to test your MovieApp

Observe the following rules:

DO NOT add any import statements to MovieApp.java

DO NOT change the headers of ANY of the given methods

DO NOT change/remove any of the given class fields

DO NOT add any new class fields

DO NOT use System.exit()

DO NOT use the IO module in MovieApp.java

YOU MAY add new helper methods, but you must declare them private

If you wish to change MovieDriver, feel free. You are not submitting it.

Explanation / Answer

package MovieList;

import java.util.*;

public class MovieApp {

public static void main (String args[])

{

System.out.println("Welcome to the Movie List Application.");

System.out.println("There are 100 movies on the list.");

Scanner sc = new Scanner(System.in);

String choice = "y";

ArrayList<Movie> myListOfMovies = createArrayList();

System.out.println(myListOfMovies.size());

while (choice.equalsIgnoreCase("y"))

{

System.out.println("There are four categories: animated, drama, horror, and scifi");

System.out.println();

String personMovieCategory = Validator.getRequiredString(sc, "What category are you interested in? ");

Collection<Movie> matchedMovies = new TreeSet<>();

for(Movie movie : myListOfMovies) {

if (personMovieCategory.equalsIgnoreCase(movie.getGenre()))

{

matchedMovies.add(movie);

}

}

for (Movie movie : matchedMovies)

{

System.out.println(movie.getTitle());

}

choice = Validator.getRequiredString(sc, "Continue? (y/n): ");

System.out.println();

}

}

public static ArrayList<Movie> createArrayList()

{

Movie m;

ArrayList<Movie> creatingArrayList = new ArrayList<>();

for (int i = 0; i <= 100; i++ )

{

m = MovieIO.getMovie(i);

creatingArrayList.add(m);

}

return creatingArrayList;

}

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote