Question: Page Practice Implement this data structure exactly as shown and test it in main: > Copiable > Comparable deepCopy0: Copiable MovieList Movie -title: String -year:

 Page Practice Implement this data structure exactly as shown and test
it in main: > Copiable > Comparable deepCopy0: Copiable MovieList Movie -title:
String -year: int -list: Movie -count: int SIZE:int UnsortedMovieList +Movie(title: String, year:
int) +getTitle(): String +getYear(): int +toString): String +equals(other: Object): boolean +hashCode(: int

Page Practice Implement this data structure exactly as shown and test it in main: > Copiable > Comparable deepCopy0: Copiable MovieList Movie -title: String -year: int -list: Movie -count: int SIZE:int UnsortedMovieList +Movie(title: String, year: int) +getTitle(): String +getYear(): int +toString): String +equals(other: Object): boolean +hashCode(: int +compare To(other: Movie): int +deepCopy): Movie rMovieList(size: int) +add(movie: Movie): boolearn +get(index: int): Movie +indexOf(movie: Movie): int +getCount(): int -incrementCount): void +UnsortedMovieList(size: int) +add(movie: Movie): boolean +indexOf(movie: Movie): int +deepCopy(): MovieList Practice MovieList uses a partially-filled array of a set size that is determined by the constructor parameter (not growable) . UnsortedMovieList's add method adds the movie to the end of the array if there is still room and if the same movie (title and year) does not already exist in the array . The get method returns null if the index is out of range . The indexOf method returns -1 if movie doesn't exist The toString method returns: title (year) How to test (in main method): UnsortedMovieList myList = new UnsortedMovieList(12); if (myList.add (new Movie("Home", 2015))) ( System.out.println(myList.get (myList.getCount() 1)); if (myList.add (new Movie("Gravity", 2013))) ( System.out.printlnmyList.get (myList.getCount()1)); Movie walle = new Movie("Wall-e", if (mylist.add(walle)) 2008); System.out.printin(myList.get(myList.getcount() 1)); System.out.printIn(myList.add(new Movie("Home", 2015))? "Home added again": "Home not added again"); System.out.println("Count "myList.getCount ()); System.out.printIn("Wall-e found at #" + myList.indexOf (walle)); Output should be: Home (2015) Gravity (2013) Wall-e (2008) Home not added again Count :# 3 Wall-e found at #2

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!