File input and output is not necessary for this assignment. The data for the lists will be manually entered by the user at run time. The program won't save the list contents to file.

Description:

For this assignment you are to write a program that allows a person to manage their movie collection. The full version will perform some common list management functions such as: adding, displaying, removing or searching. Because this is a linked list implementation (not an array) there should not be a limit on the number of movies that can be added.

Each movie will be described by four fields:

  • Movie name
  • The names of the first three cast members
  • The genre of the movie
  • The number of stars (the rating of the movie)

Description of the fields

  • Movie name. This field consists of an alpha (and sometime numeric string e.g., "STAR TREK II" can also be titled as "STAR TREK 2").
  • Cast. The cast list will consist of the full names of three of the actors from this film. A 1D array of strings can be used to store the cast information
  • Genre. The genre field describes the category that the movie falls into. There will be six different categories of movies: action, drama, science fiction, comedy, horror, martial arts or 'other'. You don't have worry about checking for instances where a movie falls into multiple genres.
  • Rating. This field uses a number of stars to rate each movie according to its entertainment value1. The greater the number of stars, the better the movie:
    • 1 star (It sucks): It's not the type of movie that's so bad that it's good, it's just all bad. Don't waste your time with this one.
    • 2 stars (Poor): Overall there were more things that I disliked than liked with this movie. Unless there's a ticket sale it's probably one that you should avoid.
    • 3 stars (Average): There were some things that I liked and some things that I disliked. It's one that you may want to rent/stream rather than buy.
    • 4 stars (Good): This movie has some flaws but overall you'll have a great time watching it.
    • 5 stars (A true masterpiece!): I laughed, I cried, it became a part of me. It should definitely be nominated for an Oscar (maybe several).

When movies are displayed each field will reside on a separate line and each movie will be separated by a line of stars (but the stars are not an attribute of a movie object).

TERMINATOR 2 JUDGMENT DAY
Arnold Schwarzenegger
Linda Hamilton
Edward Furlong
Action
5 ************
IT'S A WONDERFUL LIFE
James Stewart
Donna Reed
Lionel Barrymore
Drama
5 ************
ROMEO AND JULIET
Leonard Whiting
Olivia Hussey
John McEnery
Drama
4 ************
ONCE UPON A TIME A HERO IN CHINA
Charine Chan
Tony Leung Kai Fai
Peeking Duck aka James Tam
Martial Arts
3 ************

Classes

The basic structure is very similar to the Dice/User interface program to be covered in tutorial:

  • Driver: contains the main method which kicks things off by calling a 'start' method of class UserInterface
  • UserInterface: handles user input and output, the start method will likely contain the main program loop that only ends when the user quits the program. To actually change or view the list the user interface class will invoke methods of class Manager. These operations must not be directly implemented in the user interface.
  • Manager: handles all list operations such as adding, removing etc.
  • MovieNode: A linked list node whose data attribute is a movie.
  • Movie: Stores data associated with an individual movie (instances contains the 4 attributes associated with a movie such as name, cast etc.)

Program features

  • Displays an introduction to the program (describes how it works) each time that it's run.
  • Displays a sign off exit message to indicate to the user that the program has ended.
  • Defines class 'Movie' with the 4 attributes described above.
  • Defines class 'MovieNode' (analogous to 'BookNode' from my notes on linked lists) which is a class with two fields: a) 'Data' which is of type 'Movie' b) 'Next' which is a reference to a MovieNode (next node in the list or null for the end of the list).
  • Defines a 'Manager' class which will include methods for all the major list operations e.g., add, remove, search, display. Your first step is to define this class with empty methods. Later you can fill in the method bodies for the major list operations (feature #11, 14, 15, 16, 17) and the 'helper' methods for feature #10 (helper methods are features #12, 13).
  • Declares a head reference/pointer of type 'MovieNode' which is initialized to null. The head reference is an attribute of the Manager class.
  • Defines a 'UserInterface' class which is responsible for all interactions with the user (displaying program options, getting user input). This class does not implement the same operations as the manager class! The user interface class is responsible for displaying a menu of features available (#8 below), getting the user's selection, checking the validity of the input and determining the option selected. This class should not include the actual code for changing/displaying the list itself. Once the appropriate menu option has been determined (e.g., 'a') then the user interface class will tell class manager to run the appropriate method (e.g., 'addNode()'). In tutorial the TA's covered an example program that approximately mimics how the UserInterface class and the Manager class interact. In that example the 'GameInterface' class will be analogous to the 'UserInterface' class and the 'Dice' class will be roughly analogous to the 'Manager' class. To get credit for the UserInterface class definition (feature #7) you simply have to outline the empty methods and attributes. Credit for implementing those methods are part of feature #8, 9 and several methods associated with #10.
  • (Class UserInterface method): Displays a menu listing the features available. (The menu options don't have to be functional yet, to get credit for this the feature the menu just has to be displayed).
  • (Class UserInterface method): The program repeats until the user quits. Each time that the program repeats the main menu (above) is displayed. The (Q)uit menu option has been implemented.
  • (Other methods of class UserInterface): Checks that the user's menu selection was valid and if so it determines what option was selected (likely through branching).
  • (Class Manager method) (A)dd a movie to the collection: You are to implement one of two versions. (You only get credit for one version or the other). In both cases the program will prompt the user to enter each field oneatatime. Although the program doesn't have to check for duplicate movies it should error check the genre and the rating when new movies are added. (See the next two features). The add feature must be implemented before you can get credit for any of the other features that follow it.
    • The simple version will insert new movies at the end of the list.
    • The advanced version will insert movies in ascending order of name (in-order insertion). You can use the String method 'compareToIgnoreCase' (i.e., case insensitive) to determine ordering. Note: an inorder insertion is NOT the same as sorting the list! For this feature you need to find the insertion point and then add the node at that point and NOT change ordering of the other elements.
  • (Class Manager method to be executed when the add feature is invoked): The genre should only be one of the types listed above. If not the program should continue prompting the user for a value until either a valid genre is entered, or the person signals that they wish to cancel adding a new movie (by just hitting enter blank genre during the error handling loop).
  • (Class Manager method to be executed when the add feature is invoked): The program should check that the rating is a value between one and five. If not then the program should continue prompting the person for the number of stars until either a legitimate value is entered or the person enters a negative value (to signify that they wish to cancel this option).
  • (Class Manager method) (D)isplay implemented: Each movie will be separated onscreen by a line of stars. When the list of movies is long, to prevent the output from scrolling off the screen your program should 'pause' the display of movies every 4th movie while it waits for the user to 'Hit enter to continue'. The output must be displayed in a neat and legible format. (See the above example). The program should display an appropriate status message if the list is empty (e.g., "List is empty: nothing to display"). (JT's hint: you should implement this feature soon after you complete the add feature because it's essential for testing the other features).
  • (Class Manager method) (S)earch: The user types in the name of the movie (case insensitive) to see full information about that movie. If the list is empty then the program should inform the user of this fact and no search should be performed. If the movie is not in the list, then your program should indicate that the movie could not be found under that name. If the movie is in the list, then your program will display additional details about that movie (all the fields of that movie will be displayed onscreen).
  • (Class Manager method) (R)emove a movie from the list: You can implement one of two versions of this feature (you only get credit for one). In both cases the program should produce some sort of error message if the list is already empty when this feature is invoked.
    • The simple version will just remove the last node from the list.
    • The advanced version will prompt the user for the name of the movie to remove. The program will then search for and remove the first instance of that movie (case insensitive search). Similar to the search, an appropriate status message should be displayed if no matches were found.
  • (Class Manager method) (O)pposite order display: Invoking this method will recursively display the list in reverse order (last movie display first, second last movie displayed second...the first movie is displayed last). This method should only display the list in reverse order but it should NOT change the actual order of the nodes in the list (i.e., after calling this method the movie that was first in the list should still be first in the list etc.) (JT's hint: some of you may find that this last feature is significantly harder than the other features so you might want to work on this one last.) An appropriate status message should be displayed if the list is empty.
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.