B(i) - Background information and description
B(ii) - Program Requirements/Functionality
B(iii) - Text files to be processed
B(iv) - Required Classes
B. Project Details
B(i) - Background information and description
Software such as iTunes and MediaPlayer enable easy access to, and organization of, digital media such as music, movies, podcasts, and books. The software typically allows the user to view their collection of digital media via different views; for example, the user may view their collection of movies by Title, Genre, and Rating. The software also allows the user to create customized playlists that contain movies of their choice from their digital library.
In this project your task is to create an object-oriented menu-driven Java program that implements a limited set of functionality similar to iTunes for movies (but without the GUI).
To do this your program will need to read data from the keyboard and from certain text files in secondary storage, store the data in appropriate data structures using objects, sort the data, and write output data to both the screen and to secondary storage. The specific functional requirements are described in section B(ii). The text files that are to be used for this programming project are described in section B(iii). The classes that must be used as a minimum are described in section B(iv).
B(ii) - Program Requirements/Functionality
The Java program must
a) be object-oriented utilizing the classes described in section B (iv) as a minimum. Other classes may also be needed to solve the program requirements;
b) be menu-driven. The main menu must have the following menu items:
1. Movies
2. Playlists
3. Save
4. Exit Program
c) be able to process the defined text files. The text files and their formats are described in section B (iii).
Program Start Up
When the java program starts it must perform the following file related operations:
d) Read the data from the movieLibrary.txt file into computer memory into an appropriate array of objects (see section B (iii) for a description of the movieLibrary text file and section B (iv) for a description of the Movie class). If the movie library file does not exist, then the user should be informed of this and given the option of either creating a new (empty) movie library file or providing an alternative filename that contains the library of movies;
e) Read the data from the playlist.txt file into computer memory into an appropriate array of objects (see sectionB (iii) for a description of the playlist text file and section B (iv) for a description of the Playlist class). If the playlist file does not exist this simply means that there are no playlists created for the current library of movies;
After processing these files, the program should display the main menu identified in section B(ii)(b) above.
Main Menu Item Functionality
The required functionality for each menu item is described as follows:
1. Movies - when this menu option is selected the following sub-menu should be displayed:
1. Display Movies
2. Sort Movies
3. Rate Movie
4. Change Movie Genre
5. Add Movie to Library
6. Exit Sub-menu
Implement Java code for these sub-menu items as follows:
1. Display Movies the program must display the complete library of movies to the screen in an appropriate readable format. Display the movie title, duration, genre, classification and rating.
2. Sort Movies when this menu item is selected the following sub-menu should be displayed:
1. by title
2. by genre
3. Exit Sub-menu
Implement Java code for these sub-menu items as follows:
1. by title – sort the entire library of movies alphabetically by movie title
2. by genre – sort the entire library of movies alphabetically by genre
3. Exit Sub-menu – program control should return to the previous menu.
3. Rate Movie when this menu item is selected the user should be able to search for a movie by its title and then rate it. Ratings for movies are whole or half numeric values between 0 and 5. For example, ratings of 3 and 4.5 are valid but ratings of 1.2 or 2.9 are not valid.
4. Change Movie Genre when this menu item is selected the user should be able to search for a movie by its title and then set the genre for the movie. The genre should be chosen by the user from the following possible values: Action, Adventure, Comedy, Crime, Fantasy, Family, Romance, Horror, Drama, Sci-Fi, Thriller.
5. Add Movie to Library when this menu item is selected the user should be able to enter the details for a movie they wish to add to the movie library. After the details have been obtained from the user the movie should be added to the movie library array.
6. Exit Sub-menu program control should return to the main menu.
2. Playlists - when this menu option is selected the following sub-menu should be displayed:
1. Display Playlists
2. Create Playlist
3. Add Movie to Playlist
4. Exit Sub-menu
Implement Java code for these sub-menu items as follows:
1. Display Playlists - the program must display the names of each of the playlists. The user should then be able to choose one of these playlists. Doing so will display to the screen the movies that are in the chosen playlist. When displaying the movies you must display the movie title, duration, genre, classification and rating.
2. Create Playlist the program must create an empty playlist. Obtain from the user a name for the new playlist and store the playlist in an appropriate array.
3. Add Movie to Playlist the program must add a movie from the library to an existing playlist. To do this the user will need to choose the playlist to which they wish to add the movie and they will need to choose the movie to add from the library.
4. Exit sub-menu program control should return to the main menu.
3. Save the program must write the movie library data back to the movieLibrary.txt file and write all playlists to the playlists.txt file
4. Exit Program the program must terminate when this menu item is selected. The program should not terminate until this option is chosen. At other times the program should return to display the Main menu after completing the chosen menu option.
B(iii) - Text files to be processed
The data that is to be manipulated by your Java program in this programming project is contained in the text files movieLibrary.txt, and playLists.txt. Examples of these files are found in the zip file for this programming project. The data within these text files will need to be read into memory by your program so that it may be manipulated to solve many aspects of the required functionality of this programming project. The text files have been created to conform to a particular format. The format for each file is described below:
This file contains a full record of all movies currently held in a digital movie library. Each line within the file represents a movie from the library, and has the following format:
Movie ID, Movie Title, Director, Writer, Duration, Genre, Classification, Release Date, Rating
where each data item is separated by a comma (,).
A brief explanation of each of these data items:
Movie ID: a unique numeric identifier for a movie
Movie title: the title/name of the movie
Director: the name of the director of the movie
Writer: the name of the writer of the screenplay
Duration: the duration of the movie in hours (eg a duration of 3.5 = 3 hours and 30 minutes)
Genre: a categorization of the movie (for example, Action, Adventure, Family, Fantasy, etc)
Classification: a classification of the movie (for example, G, PG, M, MA 15+, etc)
Release Date: when the movie was released.
Rating: a numeric value in the range 1 to 5 indicating the users rating for the movie (this may not have a value if the user hasn’t rated the movie yet)
Ive attached movieLibrary.txt file above in the document
This file contains a full record of all playlists for the movie library. Each line within this file represents an individual playlist, and has the following format:
Playlist ID, Name, Length, Movies
where each data item is separated by a comma (,).
A brief explanation of each of these data items:
Playlist ID: a unique numeric identifier for the playlist
Name: a name for the playlist
Length: the number of movies in the playlist
Movies: a list of zero or more Movie IDs which make up this playlist
Ive attached playLists.txt file above in the document
Please note that for the purpose of marking the project the number of lines of data and the data values in the text files will be replaced with different data by the marker. This is to ensure that your solution has not relied upon specific data values or the number of lines in the text files to work. You should therefore test your program with different data files of varying length and varying data.
B(iv) - Required Classes
To write your solution for this project it is a requirement that you write appropriate code for at least the following java Classes:
a) Movie
b) Playlist
These classes are described in general terms as follows:
a) Movie class: The Movie class represents an individual movie within the movie library. The Movie class needs data fields for the Movie ID, movie title, director, writer, movie duration, genre, movie classification, and the release date. Implement appropriate constructors, accessors, mutators and other appropriate methods for this class based upon the general requirements of the assignment specification.
b) Playlist class: The Playlist class represents a collection of movies that have been chosen by the user from the library. The Playlist class needs data fields for the playlist ID, the playlist name, the playlist length (this is the number of movies in the playlist), playlist duration (the total duration of all movies in the playlist), and movies (this is the list of movie IDs which make up the playlist). Implement appropriate constructors, accessors, mutators and other appropriate methods for this class based upon the general requirements of the assignment specification.
Apart from the above two classes it is quite likely that you will also need to write other classes depending upon your solution method.