Lecture notes for the Introduction to Computer Science I by James Tam Return to the course web page

CPSC 231: Assignment 8 (Worth 5%)

Grading Scales

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

 

 

New concepts to be applied for this assignment

 

Assignment description

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. 

Each movie will be described by four fields with each field residing on a separate line (or lines in the case where there are sub-fields) in the following order:

  1. Movie name

  2. The names of the first three cast members.

  3. The genre of the movie

  4. The number of stars (the rating of the movie)

 

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.

 

Grading

(Bare bones) basic assignment (worth 10 marks)

Extra features:

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.

 

Submission requirements

In addition to having fulfill the generic assignment requirements, the requirements specific to this assignment include:

  1. Include a README file in your submission:  For this assignment your README file must include your contact information: your name, university identification number and UNIX login name so that your marker knows whose assignment that he or she is marking.   For this assignment you should also list the features that you implemented.

  2. Assignments (source code/'dot-p' file and the README file) must be electronically submitted.  In addition a paper print out of the source code and README must be handed into the assignment drop box (located on the second floor of the Math Sciences building) for the tutorial that you are registered in.  Electronically submitting the assignment allows your marker to run the code in order to quickly determine what features were implemented.  Providing a paper printout makes it easier for your marker to read and flip through your source code.  Unless you are told otherwise you are to email your source code and readme file to your TA and to me.  Make sure that include the following information in the subject line: "CPSC 231 Assignment X" where 'X' stands for the assignment number that you are submitting e.g., "CPSC 231 Assignment 3".

  3. As a reminder, you are not allowed to work in groups for this class.   Copying the work of another student will be regarded as academic misconduct (cheating).  For additional details about what is and is not okay for this class please refer to the following link.

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