In Java, Create Movie class, which has private fields for title, director, rating. It has a constructor to initialize these fields and a toString method for printing movie details. There is also a getRating method to retrieve the movie rating. Create Rating Comparator class which implements the Comparator interface for comparing movies based on their ratings. Create DemoMovies Class. Initialize necessary data structures like Linked List, TreeMap for rating as key and Movie from Movie class as value, TreeSet, and ProtiyQueue. Use a loop to take user input for movie detailsuntil the user enters 'WWW' as the movie title.Inside the loop, for each movie, create a Movie object, add it to various data structures that is title, director and rating based on the constructor.Add the Movie object to the Linked List. Add the rating and the object to the TreeMap.Add the rating to the TreeSet. Add the Movie object to the PriorityQueue.Display the entered movies. Sort and display Movies by rate by using TreeMap to automatically sort Movies by rate and display them. Remove Movies with Rating less than 5.0 using removeAll.Use an iterator to go through the list of Movies and remove those with a rating less than 5.0(use while loop for iterator and if statement for rate less than 5). Create an array list to add the unrented movies and add them to the list created. Use a tree map to store movies with a rating greater than or equal to 5.0and display them sorted by Rate.Display the keys and values from the TreeMap.Create a PriorityQueue from the movies stored in the TreeMap and display it based on movie ratings.

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter9: Using Classes And Objects
Section: Chapter Questions
Problem 19RQ
icon
Related questions
Question
In Java, Create Movie class, which has private fields for title, director, rating. It has a constructor to initialize these fields and a toString method for
printing movie details. There is also a getRating method to retrieve the movie rating. Create Rating Comparator class which implements the
Comparator interface for comparing movies based on their ratings. Create DemoMovies Class. Initialize necessary data structures like LinkedList,
TreeMap for rating as key and Movie from Movie class as value, TreeSet, and ProtiyQueue. Use a loop to take user input for movie detailsuntil the
user enters 'WWW' as the movie title.Inside the loop, for each movie, create a Movie object, add it to various data structures that is title, director
and rating based on the constructor. Add the Movie object to the LinkedList. Add the rating and the object to the TreeMap.Add the rating to the
TreeSet.Add the Movie object to the Priority Queue.Display the entered movies. Sort and display Movies by rate by using TreeMap to
automatically sort Movies by rate and display them. Remove Movies with Rating less than 5.0 using removeAll.Use an iterator to go through the
list of Movies and remove those with a rating less than 5.0(use while loop for iterator and if statement for rate less than 5). Create an array list to
add the unrented movies and add them to the list created. Use a tree map to store movies with a rating greater than or equal to 5.0and display
them sorted by Rate.Display the keys and values from the TreeMap.Create a PriorityQueue from the movies stored in the TreeMap and display it
based on movie ratings.
Transcribed Image Text:In Java, Create Movie class, which has private fields for title, director, rating. It has a constructor to initialize these fields and a toString method for printing movie details. There is also a getRating method to retrieve the movie rating. Create Rating Comparator class which implements the Comparator interface for comparing movies based on their ratings. Create DemoMovies Class. Initialize necessary data structures like LinkedList, TreeMap for rating as key and Movie from Movie class as value, TreeSet, and ProtiyQueue. Use a loop to take user input for movie detailsuntil the user enters 'WWW' as the movie title.Inside the loop, for each movie, create a Movie object, add it to various data structures that is title, director and rating based on the constructor. Add the Movie object to the LinkedList. Add the rating and the object to the TreeMap.Add the rating to the TreeSet.Add the Movie object to the Priority Queue.Display the entered movies. Sort and display Movies by rate by using TreeMap to automatically sort Movies by rate and display them. Remove Movies with Rating less than 5.0 using removeAll.Use an iterator to go through the list of Movies and remove those with a rating less than 5.0(use while loop for iterator and if statement for rate less than 5). Create an array list to add the unrented movies and add them to the list created. Use a tree map to store movies with a rating greater than or equal to 5.0and display them sorted by Rate.Display the keys and values from the TreeMap.Create a PriorityQueue from the movies stored in the TreeMap and display it based on movie ratings.
Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Arrays
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,