Due Date:
Thursday, March 28
File(s) to be submitted:
RatedEpisode.java, TopShows.java
Sample Output:
SampleOutput.html
Starter Files:
Summary
Your job this week is to write a program (TopShows) that finds and extracts the top-rated episodes from a list of episodes with ratings. As part of that task, you need to create a couple of Comparators in the class RatedEpisode.
I have provided you with a list of Northern Exposure episodes along with their IMDb ratings.
Your program must use methods from the provided class Quick. It may not use any sorting methods not found in that class.
Your program must use the RatedEposide class to hold the information about the episodes. This class has a method called parseEpisode that can be used to change a line from a text file (such as NorthernExposureEpisodes.txt) into RatedEpisode objects.
Your program must execute the following steps, with a pause after each:
I have provided a file named NorthernExposureEpisodes.txt. If you are using NetBeans this file needs to be in your project folder (A09/, or whatever you name your project), not in its src/ folder or any other subfolder).
When you use that file and ask for the top 20 episodes it will find that the lowest-rated episode of the top 20 has a rating of 8.4. There are two more episodes (outside the top 20) that have a rating of 8.4, so it adds them to the top-20 list to make a top-22 list. That is the list it prints out at the end. (See the sample output.)
I have provided you with a class called Quick that has multiple quicksort-based methods defined in it. It has two versions of each method -- one with a Comparator and one without. The methods you might be interested in are:
Note that, for the versions with a Comparator, "smallest" and "largest" are defined in terms of that Comparator. For versions without, the "natural order" is used.
I have provided you with a class called RatedEpisode which tracks the season number, episode number (within season), title, and IMDb rating for an episode. You will be interested in the method parseEpisode which takes a String with episode information and parses it into a RatedEpisode. You can read the text file line by line and parse each line into a RatedEpisode to add to your List of RatedEpisodes.
For efficiency reasons, use an ArrayList as the object type.
The RatedEpisode class has no Comparators defined. You will need to add at least two:
You may add other Comparators as desired, or as required for your program to work.