Lecture notes for the Introduction to Computer Science I by James Tam | Return to the course web page |
Ranges | Letter |
23 - 24 | A+ |
21 - 22 | A |
19 - 20 | A- |
17 - 18 | B+ |
15 - 16 | B |
13 - 14 | B- |
11 - 12 | C+ |
9 - 10 | C |
6 - 8 | C- |
3 - 5 | D+ |
2 | D |
1 | D- |
0 | F |
For this assignment you are to write a Pascal program that allows a person to manage their movie collection. In the full version of the assignment your program will read the initial information a file into an array of records. (For marking purposes your program must be able to use 'movies.dat' as an input file). The user can perform common list management functions, such as adding or removing movies. When the person has finished with the program, he or she can then save the updated information back to the data file and to reload the updated information later.
Description of the fields
1. Movie name
The name of the movie will be up to 80 characters in length.
2. Cast
The cast list will consist of the full names of three of the actors from this film. Each actor's name will appear on a separate line, both in the data file and when the collection is displayed onscreen. Each actor's name acts as a sub-field for this field but you can treat each person's name as one continuous string, e.g., you don't need separate fields for the first, middle and last name. The maximum length of the name field for each actor will be 80 characters. Thus a 1D array of strings can be used to store the cast information: the number in the brackets determine which actor is being accessed while index for a particular string determines which part of an actor's name is being accessed.
[1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] ... [80] [1] H e a t h e r M o r r i s [2] R i c h a r d G r o s s e [3] D o n n a B u r k e In the example above the first element of the array is the string 'Heather Morris'. The first element of this string is the character 'H', the second is 'e' etc.
3. 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'. In the input file, the genre field will consist of a series of character up to fifteen characters in length.
4. Rating
This field uses a number of stars to rate each movie according to how good or bad that I thought it was1. The greater the number of stars, the better the movie. In the input file the number of stars that a movie received will be specified by an integer ranging from one to five.
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 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!): OMG! I laughed, I cried, it became a part of me. It should definitely
be nominated for an Oscar (maybe several).The four main fields for each movie will be followed by a line of stars:
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
5
************The lines of stars are not to be read into the array of records. It is only used to visually separate the movies in the input file.
Movie Manager: Menu options
(d)isplay collection
(l)oad a collection from disk
(s)ave the collection to disk
(q)uit the program
For the base assignment these are the only menu functions that needs to actually work. You should add additional menu options as you implement the extra features that are listed below.
Once you complete all the features of the basic assignment you can complete the extra features for additional credit (make sure you backup your work first and don't touch the working back up, modify a copy instead!) Unless there are technical considerations you can complete these extra features in whatever order or combination that you desire.
Feature one (Find additional details about a movie): 2 marks
The user of the program can type in the name of the movie (case sensitive) to find additional 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).
Feature two (Present genre): 2 marks
Genre: The user can type in a genre (case sensitive) and the program will list all the movies that fall in the genre specified by the user. If the list is empty then the program should inform the user of this fact and no search should be performed. If no instances of the genre could be found in the list, then your program should also indicate this to the user.
Feature three (Add a movie to the collection): worth a maximum of 4 marks
When this feature is selected by the user, he or she will prompted to enter in information for all the fields of the new movie. The simple implementation of this feature will add the movie to the end of the list (2 marks). The enhanced version will add the movie in alphabetical order (according to the movie title). Furthermore in order to receive credit for this feature, movies read in from file must also be stored in alphabetical order. (4 marks for the enhanced version) If a movie is to be added to the middle of the list, the movies that follow the movie to be added should be shifted 'down' the list. In both cases the program should check if the list is already full, if it is then a suitable error message should be displayed to the user and no addition will be performed.
Feature four (Remove a movie from the list): 4 marks
When the collection is displayed, no information about that movie should be displayed - not even blank spaces. You can implement this feature by shifting 'up' the array elements that follow the element to be deleted. If the list is already empty when this feature has been invoked then a suitable error should be displayed to the user. If the movie could not be found in the list then the program should display another error message (e.g., "Movie "BORAT" was not found in the collection, removal cannot be performed").
Feature five (Write an enhanced Save feature): 2 marks
In order to get credit for this feature, the program can re-load movies from an input file that it previously wrote to (i.e., multiple saves and reloads from the same 'dat' file are possible). This latter requirement means that your program must write the information to disk in the exact same format that it was originally stored. If there any differences from the original data file and the modified version your program will not be able to properly read it back into the array.
To help make sure that you haven't missed anything here is a checklist of items to be used in marking. A sample executable 'movies' can be found in UNIX under the directory: /home/231/tamj/assignments/assignment8 (coming soon).
1. | JT: The number of stars given to the movies in the input file was based solely upon my opinion and does not necessarily reflect the opinions of the university so please don't write angry letters outrage because you thought I didn't properly rate your favorite flick ☺. |