Solved by Expert Tutors
Solved by Expert Tutors
Question

Check the attachment please and let me if you any other information.

Background Information In case you’ve been living under a rock, Netflix ( www.netflix.com ) is a service that provides unlimited streaming video of movies and TV series to subscribers for a monthly fee. Netflix subscribers can assign ratings from 1-5 stars (5 being the best) to any item they view. I have provided a data file on eCourseware that lists all of Netflix’s USA offerings as of Oct. 15, 2012. If you’re wondering why this isn’t more recent, it’s surprisingly difficult to find a plain text file of Netflix’s current offerings! There are slightly over 10,000 items listed in the file, and each line is formatted like this: Title (Year) | Average Rating, Length The length is expressed in a format like 53m or 1hr 47m for a movie, or in a number of episodes/seasons for a series. Note that for this assignment, we will assume that a “movie” is anything that’s not a series. This includes things like documentaries, comedy specials, etc. The Assignment In this project you’ll be writing some software that parses (reads) the Netflix data file and allows the user to apply and remove filters to customize the results. For example, the user may want to see a list of all the TV series after 1999 that are rated higher than 4.0 stars. This would be expressed using the following three filters: 1. genre = series 2. year > 1999 3. rating > 4.0 The user should be able to add as many filters as s/he desires, and the software should allow the user to display a list of the items from the data file that match all the filters. The user should also be able to remove filters at will. Every time a filter is added or removed, the software should indicate how many items from the data file match the filter list. At minimum, your software must support the following filter formats: genre = movie genre = series title = (exact title match) year > year < rating > rating < However, feel free to implement other filters as well! Some suggestions: title contains (partial title match)
Background image of page 1
title > (alphabetical comparison) title < (alphabetical comparison) Anything involving the length (for example, length < 2hr) To help you get started, here’s the basic procedure for the project: Read the data file and create a new Media object for each line in the file. Store these objects in a list (call this masterList ). Allow the user to specify any number of filters. These filters will be stored in a separate list (call this filterList ). Each time the user adds a new filter or removes an existing filter, your code needs to search the masterList to find only the objects that match all the filters in the filterList . Copy those objects into another list (call this currentList ). You can simply list all the items in the currentList to see what matches all filters. Class Design Your project must include the following classes: An abstract Media class, with concrete Movie and Series subclasses. These classes should be designed to hold all the relevant information about an item that can be obtained from the data file. A NetflixFileReader class that handles reading the provided data file. For each line of the file, a new Media object (either Movie or Series ) should be created and added to a list of Media objects. This class should include a method that returns the finished list. A Filter class that represents a single filter. (You might be tempted to store the filters as just strings, but making a separate class will allow you to more cleanly access each element of the filter. Note that all the filters are in this format: field relation target ) Every time the user adds a filter, a new Filter object should be created and placed in a list. Removing a filter should remove it from this list. A client program with a main method to run. Other Requirements Implement error checking on all user inputs, including exception handling where appropriate. Your software should never crash due to user input! Examples of error checking that should be implemented: o Ensuring the user cannot enter an invalid filter o Ensuring the user cannot remove a filter that doesn’t exist o Ensuring the user cannot enter an invalid entry after any menu Use Java’s built-in classes (either java.util.ArrayList or java.util.LinkedList ) to store the lists of Media objects and the list of Filter objects. How you enter filters is up to you. The version I demonstrated in class just allows you to type in the filters directly, but if you find it easier to write a menu-based system that’s OK too. Hints The file reading part is not super difficult, but it is not trivial. Get started on this part early, since you need it for the rest of the project! You should be able to complete the vast majority of this part without any knowledge of lists. In some IDEs (including BlueJ), I’ve noticed that Scanner sometimes stops prematurely when trying to read large text files. A workaround is to use a FileReader object in the Scanner constructor instead of a File object. So instead of Scanner longLiveSloths = new Scanner(new File(yourFileName)); do this:
Background image of page 2
Show entire document
!Women Art Revolution (2010) | 3 stars, 1hr 22m #1 Cheerleader Camp (2010) | 3 stars, 1hr 35m $5 a Day (2008) | 3.4 stars, 1hr 37m 'night, Mother (1986) | 3.7 stars, 1hr 36m 'Til Death (2006-2009) | 3.7 stars, 4 Seasons @Suicide Room (2011) | 3.4 stars, 1hr 51m ... And God Spoke (1993) | 2.8 stars, 1hr 22m .Com for Murder (2002) | 2.8 stars, 1hr 37m 1 a Minute (2010) | 2.4 stars, 1hr 29m 1 Love (2003) | 3.5 stars, 1hr 33m 10:30 P.M. Summer (1966) | 2.7 stars, 1hr 24m 10 Dead Men (2008) | 2.5 stars, 1hr 30m 10 Items or Less (2006-2009) | 2.9 stars, 3 Seasons 10 mph (2007) | 3.2 stars, 1hr 33m 10 Questions for the Dalai Lama (2006) | 3.8 stars, 1hr 26m 10 to Midnight (1983) | 3.5 stars, 1hr 41m 10 Yards: Fantasy Football (2008) | 2.5 stars, 1hr 30m 10.5 (2004) | 3.7 stars, 2 Episodes 100 Million BC (2008) | 2.8 stars, 1hr 25m 100 Tears (2007) | 2.5 stars, 1hr 31m 100 Voices: A Journey Home (2010) | 2.7 stars, 1hr 32m 100 Women (2002) | 3.2 stars, 1hr 34m 1000 Ways to Die (2008-2009) | 3.6 stars, 2 Seasons 11/11/11 (2011) | 2.7 stars, 1hr 27m 11/4/08 (2010) | 2.4 stars, 1hr 10m 11-11-11: The Prophecy (2011) | 3 stars, 1hr 22m 12 Dates of Christmas (2011) | 3.9 stars, 1hr 27m 13 Assassins (2011) | 4 stars, 2hr 5m 13 Moons (2002) | 2.8 stars, 1hr 34m 1313: Actor Slash Model (2011) | 1.7 stars, 1hr 12m 1313: Bermuda Triangle (2011) | 1.7 stars, 1hr 14m 1313: Bigfoot Island (2011) | 1.8 stars, 1hr 16m 1313: Billy the Kid (2012) | 1.9 stars, 1hr 12m 1313: Cougar Cult (2012) | 1.7 stars, 1hr 13m 1313: Frankenqueen (2012) | 1.5 stars, 1hr 16m 1313: Hercules Unbound (2012) | 1.5 stars, 1hr 12m 1313: Night of the Widow (2012) | 1.6 stars, 1hr 16m 1313: UFO Invasion (2011) | 1.6 stars, 1hr 24m 1313: Wicked Stepbrother (2011) | 1.9 stars, 1hr 15m 13B (2009) | 2.9 stars, 2hr 8m 13Teen (2005) | 2.8 stars, 1hr 22m 16 Fathoms Deep (1948) | 2.5 stars, 1hr 18m 16 to Life (2009) | 3.4 stars, 1hr 29m 16-Love (2012) | 3.7 stars, 1hr 28m 18 to Life (2010-2011) | 3.7 stars, 2 Seasons 180 South (2010) | 4.1 stars, 1hr 26m 1911 (2011) | 3.4 stars, 1hr 39m 1981 (2009) | 2.8 stars, 1hr 42m 1984 (1984) | 3.5 stars, 1hr 50m 2 Become 1 (2006) | 2.9 stars, 1hr 37m 2 Days (2003) | 3 stars, 1hr 31m 2 Days in Paris (2007) | 2.9 stars, 1hr 40m 2 Months, $2 Million (2009) | 3.5 stars, 1 Season 2-Headed Shark Attack (2012) | 2.8 stars, 1hr 27m 20 Years After (2008) | 2.9 stars, 1hr 35m 200 Motels (1971) | 3.1 stars, 1hr 39m 200 mph (2011) | 3 stars, 1hr 32m 2000 A.D. (2000) | 2.9 stars, 1hr 44m 2010: Moby Dick (2010) | 2.5 stars, 1hr 27m 2012: An Awakening (2009) | 3.1 stars, 1hr 8m 2012: Ice Age (2011) | 2.8 stars, 1hr 31m 2012: Mayan Prophecy and the Shift of the Ages (2009) | 3 stars, 1hr 16m 2012: Science or Superstition (2008) | 3.2 stars, 1hr 18m 2012: Time for Change (2010) | 3.7 stars, 1hr 25m
Background image of page 001
2012: Zombie Apocalypse (2011) | 2.9 stars, 1hr 27m 21 Grams (2003) | 3.5 stars, 2hr 4m 21 Hours at Munich (1976) | 3.3 stars, 1hr 41m 21 Up (1977) | 3.9 stars, 1hr 39m 21 Up South Africa: Mandela's Children (2006) | 3.5 stars, 1hr 14m 24 (2001-2010) | 3.9 stars, 8 Seasons 2501 Migrants: A Journey (2009) | 3.1 stars, 54m 26 Years: The Dewey Bozella Story (2012) | 3.7 stars, 49m 28 Up (1985) | 3.9 stars, 2hr 53m 2nd Take (2011) | , 1hr 42m 3 (2010) | 3 stars, 1hr 59m 3:15 (1986) | 2.9 stars, 1hr 25m 3 Magic Words (2010) | 3.3 stars, 1hr 10m 3 Musketeers (2011) | 2.9 stars, 1hr 27m 3 Steps to Heaven (1995) | 2.2 stars, 1hr 31m 3 Women (1977) | 3.3 stars, 2hr 3m 3-Day Weekend (2008) | 2.9 stars, 1hr 23m 30,000 Leagues Under the Sea (2007) | 2.6 stars, 1hr 25m 30 Days (2005-2008) | 3.7 stars, 3 Seasons 30 for 30: Catching Hell (2011) | 4 stars, 1hr 48m 30 for 30: Charismatic (2011) | 3 stars, 51m 30 for 30: Fernando Nation (2010) | 3.8 stars, 53m 30 for 30: Four Days in October (2010) | 4.1 stars, 52m 30 for 30: Guru of Go (2010) | 3.8 stars, 53m 30 for 30: Into the Wind (2010) | 3.8 stars, 56m 30 for 30: Jordan Rides the Bus (2010) | 3.8 stars, 54m 30 for 30: June 17th, 1994 (2010) | 3.6 stars, 52m 30 for 30: Kings Ransom (2009) | 3.6 stars, 52m 30 for 30: Little Big Men (2010) | 3.4 stars, 52m 30 for 30: Marion Jones: Press Pause (2010) | 3.5 stars, 53m 30 for 30: Muhammad and Larry (2009) | 3.6 stars, 53m 30 for 30: No Crossover: The Trial of Allen Iverson (2010) | 3.7 stars, 1hr 22m 30 for 30: Once Brothers (2010) | 4.1 stars, 1hr 22m 30 for 30: Pony Excess (2010) | 4 stars, 1hr 46m 30 for 30: Ren e (2011) | 2.9 stars, 1hr 18m 30 for 30: Roll Tide / War Eagle (2011) | 3.9 stars, 53m 30 for 30: Run Ricky Run (2010) | 3.9 stars, 53m 30 for 30: Silly Little Game (2010) | 3.4 stars, 52m 30 for 30: Small Potatoes: Who Killed the USFL? (2009) | 3.7 stars, 53m 30 for 30: The 16th Man (2010) | 3.8 stars, 53m 30 for 30: The Band That Wouldn't Die (2009) | 3.4 stars, 54m 30 for 30: The Best That Never Was (2010) | 4 stars, 1hr 41m 30 for 30: The Birth of Big Air (2010) | 4 stars, 54m 30 for 30: The Dotted Line (2011) | 3.6 stars, 56m 30 for 30: The House of Steinbrenner (2010) | 3.4 stars, 53m 30 for 30: The Real Rocky (2011) | 3.8 stars, 57m 30 for 30: The Two Escobars (2010) | 4.2 stars, 1hr 45m 30 for 30: The U (2010) | 4.1 stars, 1hr 43m 30 for 30: Tim Richmond: To The Limit (2010) | 3.6 stars, 53m 30 for 30: Unguarded (2011) | 4.2 stars, 1hr 20m 30 for 30: Unmatched (2010) | 3.2 stars, 53m 30 for 30: Winning Time: Reggie Miller vs. The New York Knicks (2010) | 4.2 stars, 1hr 10m 30 for 30: Without Bias (2009) | 3.9 stars, 52m 30 Rock (2006-2012) | 3.9 stars, 6 Seasons 32 Short Films About Glenn Gould (1993) | 3.6 stars, 1hr 33m 35 and Ticking (2011) | 3.9 stars, 1hr 48m 35 Up (1991) | 4 stars, 1hr 55m 3D Dive (2011) | , 3 Episodes 3D Safari (2011) | 3 stars, 13 Episodes 4 (2005) | 2.7 stars, 2hr 5m 4:20 Hour Stand-Up (2009) | 3.3 stars, 53m 4 Life (2007) | 3.4 stars, 1hr 19m
Background image of page 002
Show entire document
Sign up to view the entire interaction

Step-by-step answer

nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie cons

pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolo

Driver.java
llentesque dapibus efficitu ongue vel laoreet ac, dic s a molestie consequa congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsu cing elit. Nam lacinia pulvinar tortor nec facilis

Subscribe to view the full answer

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question
Let our 24/7 Computer Science tutors help you get unstuck! Ask your first question.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes