Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

MOVIELIST.JAVA 1 2 /* This class encapsulates a list of movies in a user's collection. 3 * The list is implemented as an array of

MOVIELIST.JAVA

1 2 /* This class encapsulates a list of movies in a user's collection. 3 * The list is implemented as an array of type Movie. 4 * Each movie is represented by an instance of the Movie class. 5 */ 6 public class MovieList { 7 //Class member variable declarations: 8 9 // TODO: Put your declarations here. 10 11 12 /* Constructor that initializes the member variables. The array is 13 * created using the initial length passed in to the constructor. 14 * The initialLength is assigned to the initial length passed in to the constructor. 15 * The numMovies is initialized to 0. 16 * Any other member variables are initialized as well. 17 */ 18 public MovieList(int initialLen){ 19 // TODO: Implement this method. 20 } 21 22 /* Add the newMovie passed in to the next available cell in the movieList. 23 * Available (empty) cells have the value NULL. The numMovies variable may be used 24 * to keep track of the index of the next available cell. 25 * For example, if the list contained: item1, item2, NULL, NULL, 26 * the next available cell is at index 2. 27 */ 28 public void addMovie(Movie newMovie){ 29 // TODO: Implement this method. 30 } 31 32 /* This method returns an array that contains only Movie objects whose 33 * title matches the targetTitle passed in. 34 * The array returned does not contain any NULL values. 35 * This method returns an array of length 0 if there are no matches. 36 * This method may call the getOnlyItems method. 37 */ 38 public Movie[] findMoviesByTitle(String targetTitle){ 39 // TODO: Implement this method. 40 return null; 41 } 42 43 /* This method returns an array that contains only Movie objects whose 44 * genre matches the targetGenre passed in. 45 * The array returned does not contain any NULL values. 46 * This method returns an array of length 0 if there are no matches. 47 * This method may call the getOnlyItems method. 48 */ 49 public Movie[] findMoviesByGenre(String targetGenre){ 50 // TODO: Implement this method. 51 return null; 52 } 53 54 /* This method returns an array of all of the Movie objects that are 55 * stored in the movieList. The array returned does not contain any NULL 56 * values. This method returns an array of length 0 if the movieList is empty. 57 * This method may call the getOnlyItems method 58 */ 59 public Movie[] getMovieListAsArray(){ 60 // TODO: Implement this method. 61 return null; 62 } 63 64 /* Returns the number of Movies stored in the movieList. 65 */ 66 public int getNumMovies(){ 67 // TODO: Implement this method. 68 return -500; 69 } 70 71 /* Returns true if the movieList contains no Movies, false otherwise. 72 */ 73 public boolean isEmpty(){ 74 // TODO: Implement this method. 75 return false; 76 } 77 78 /****** Private, "helper" method section ******/ 79 80 /* Creates a new array that is double the size of the array passed in, copies the data 81 * from that array to the new array, and returns the new array. 82 * Note that the new array will contain the Movies from the previous array followed by NULL values. 83 */ 84 private Movie[] expandList(Movie[] inputList){ 85 // TODO: Implement this method. 86 return null; 87 } 88 89 /* A full Movie list is an array where all cells contain a Movie. That 90 * means there is no cell that contains NULL. 91 * This method returns true if all cells in the array contain a Movie 92 * object, false otherwise. 93 */ 94 private boolean isFull(){ 95 // TODO: Implement this method. 96 return true; 97 } 98 99 /* 100 * This method takes an array of Movies as an input as well as 101 * the number of Movies on that array. The inputArray may contain 102 * some NULL values. 103 * This method returns an array that contains only the Movies in 104 * the input array and no NULL values. 105 * It returns an array of length 0 if there are no Movies in the input array. 106 */ 107 private Movie[] getOnlyItems(Movie[] inputArray, int size){ 108 // TODO: Implement this method. 109 return null; 110 } 111 }

MOVIE.JAVA (CANNOT BE MODIFED)

1 /** 2 * This class encapsulates the data required to represent a movie in a collection 3 * of Movies. The attributes of a movie are title, director, genre, 4 * playing time, lead actor, and year of release in the form YYYY (i.e. 2018). 5 **/ 6 public class Movie { 7 8 private String title; 9 private String director; 10 private String genre; 11 private int playTime;// in minutes 12 private String leadActor; 13 private String releaseYear; //in the form YYYY 14 15 /* Constructor 16 */ 17 public Movie(String title, String director, String genre, 18 int playTime, String leadActor, String releaseYear){ 19 this.title = title; 20 this.director = director; 21 this.genre = genre; 22 this.playTime = playTime; 23 this.leadActor = leadActor; 24 this.releaseYear = releaseYear; 25 } 26 27 // get method for the title 28 public String getTitle(){ 29 return title; 30 } 31 // get method for the author 32 public String getDirector(){ 33 return director; 34 } 35 // get method for the genre 36 public String getGenre(){ 37 return genre; 38 } 39 // get method for the playing time 40 public int getPlayTime(){ 41 return playTime; 42 } 43 // get method for the lead actor 44 public String getLeadActor(){ 45 return leadActor; 46 } 47 // get method for the release year 48 public String getReleaseYear(){ 49 return releaseYear; 50 } 51 /* The return should have the format: 52 * Movie: [title], [director], [genre], [playTime], [leadActor], [releaseYear] 53 * For example: 54 * "Movie: Black Panther, Coogler, fantasy, 134, Chadwick Boseman, 2018" 55 */ 56 public String toString(){ 57 return "Movie: "+title+", "+director+", "+genre+", "+playTime+", "+leadActor+", "+releaseYear; 58 } 59 }

I CANNOT POST THE TRANSCRIPT OF THE LIBRARYMAIN.JAVA BECAUSE IT WOULD BE TOO LONG

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

Write an elaborate note on marketing environment.

Answered: 1 week ago