CPSC 231: ASSIGNMENT 7 (Due Friday June 27: Worth 6%)

 

Note: Except for parts marked with *New*, the specifications for assignment 7 are similar to the ones described in Assignment 6.

Assignment description (Music! Music! Music!)

For this assignment you are to write a Pascal program that allows a person to track a list of their favorite audio CD's.  For each CD there will be five fields with each field residing on a separate line in the following order:

  1. Title
  2. Artist
  3. Price
  4. Rating
  5. Category

After the five fields that describe each CD a blank line will separate the information for this CD from the fields of the next CD.  In the example below, we see how the information for "LESS THAN ZERO" is separated from "GLASS HOUSES" by a blank line (contains an end-of-line marker).

LESS THAN ZERO
Various artists
13.83
3
R
<BLANK LINE>
GLASS HOUSES
Billy Joel
14.99
4
R

Description of the fields

1. Title

The name of the CD will be a string up to 80 characters in length.

2. Artist

There are three possible values for this field:

In all three cases this field will take the form of a string up to 80 characters in length.

3. Price

This field will be a real value and exclude the dollar sign but include the decimal.

4. Rating

This field rates each CD according to how good or bad that I thought it was1.  The rating will be an integer value in the range of 1 - 5 (inclusive).  The higher the number, the more that  I liked the CD. 

    Rating of 1 (It sucks):  It's not the type of music that is so bad that it's good, it's just bad.  Don't  
    waste your time with this one.

    Rating of 2 (Poor): Overall there were more things that I disliked than liked with this title.   
    Probably one that you should still avoid.


    Rating of 3 (Average): There were some things that I liked and some things that I disliked about this
    title.  It's one that you'll want to sample for free before spending your money on.

    Rating of 4 (Good):  This title has some flaws but overall you'll have a great time listening it.

    Rating of 5 (A true masterpiece!):  While listening to it I laughed, I cried, it became a part of me. 
    It should definitely be nominated for an award (maybe several).

1. JT: The number of stars given to the CD's 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 to them because you thought I didn't properly rate your favorite title

5. Category

This field classifies the CD into different types of categories of music.  The letter in front of the slash indicates the character used in the data file while the value after the slash provides a full description of what category that the character stands for.

P/Pop

D/Dance

C/Classical

H/Hip hop

R/Rock

T/Techno

Relevant files *New*

The information for the CD's is stored in the Unix text file, called "music".   This file contains a list of  33 CD's.  In your typescript you must use the list of CD's in the music file as the input file for your program.   For your own testing purposes you can use a smaller version of this file called "mini_music".  In addition, I will soon put in the assignment directory an executable program, called "a6",  that reads the CD list from a file and displays it back to the screen (to provide you with an example output style).  Unlike the case with assignment 6, where your program read the CD's into an array of records, your program for assignment 7 is to read in the information for the CD's from the file and store it in a linked list   From there you program should be able to perform some basic list management features which are described in the following section, "Assignment grading".

 

Assignment grading *New*

Make sure you clearly indicate in your README file which grade level that you think you have completed for this assignment.  This should be followed by a list of the features that you have implemented in your program..  As was the case with the previous assignment, failure to provide this information will result in a grade reduction of one letter step e.g., "A" to "A-".

e.g.,  Assignment for James Tam

         "B+" level assignment

        Features completed:

        1) All the requirements of a "C+" level assignment

        2) The ability to search for a CD by it's title

        3) The ability to add a CD to the list

        4) The ability to delete an existing CD from the list

D- version (0.7 GPA for the assignment))

The student has invested a considerable effort in the assignment, but the program does not compile.

D version (1.0 GPA for the assignment)

The student has invested a considerable effort in the assignment, the program compiles but does it not fulfill any of the requirements listed in the assignment specification.

Basic Assignment Submission: C+ level assignment:  

Your program reads the information from file into the array and you display the contents of that array onscreen with write's and writeln statements.  The output must be displayed in a neat and legible format file (see the example format provided with the sample executable "a6").    Also, your program must be able to write the list back to a file called "modified_music".  In addition,  the assignment must be properly documented and must follow a good programming standard in order to qualify for a "C+" grade. Similar to the previous assignment, your program has menu driven interface.  The basic program should display a menu similar to the one shown below:

Music Collection: Menu options

(D)isplay collection

(L)oad a collection from disk

(S)ave a collection to disk

(Q)uit program

You should add additional menu options as you implement the extra features that are listed below.

Extra features

Completion of each of these extra features will result in the increase of a "one step" increase in your grade e.g., C+ to B-.  Except for features two, four  and six you can complete as many of the features below as you wish in whatever combination that you desire.   In the case of those three features you must have completed feature two before you can get credit for feature four or six.   Successful completion of all seven features will make you eligible for an A+.   

Feature one (Alphabetize the list according to title):

Unlike the case with Assignment 6, you do not need to implement this feature to get an A+.

Feature two (Find additional details about a CD):

The user of the program can type in the title to find additional information about that CD .  If the CD is not in the list, then your program should indicate that the CD could not be found under that title.  If the CD is in the list, then your program will display additional details about that CD (all five fields of that CD will be displayed onscreen).

Feature three (Present all CD that meet a certain criteria):

This feature allows the user of the program to display onscreen only CD's that meet a certain criteria for one of the seven fields.  To fulfill the requirements for this feature you need to implement the Present feature for one of the following cases (but you won't get additional marks for implementing it for more than one case): 

    Artist: The user can type in the name of the artist and your program will display all 
    CD's in the collection that were produced by that artist..

    Rating:  The user can type in a numerical value that indicates the minimum acceptable rating
    that a CD must have.  The program will then present only those CD's that received the
    specified rating or greater.  

    Category: The user can type in a character to represent one of the categories of music and the program
    will display all titles that fall under that category e.g., the user types in 'd' and the program would
    show all the dance CD's that were currently in the collection.

Because feature number one is no longer a requirement CD's will presented in unsorted order..  

Feature four (Edit CD information - requires that you have already completed feature two):

Edit the information for a CD in the list.  In order to complete the requirements for this feature you must have completed feature two because the user of the program must indicate to the program which CD that they wish to edit by entering the title of the CD.  When the edit feature is selected, the user of the program will then be able to edit all the fields of  a CD one field at a time.

Feature five (Insert CD at the end of the list):

When this feature is selected by the user, he or she will prompted to enter in information for all the fields of the new CD.  You are not required to have the user edit only some of the fields (although you can do this if you wish).

Feature six (Remove CD from the list - requires that you have already completed feature number two):

Again, since the user must type in the title in order to indicate which CD that he or she wishes to remove from the list you need have complete the lookup CD feature first (feature two).   

Feature seven (Clear the entire list)

This feature allows the user to remove all CD's from the list.  

 

New Concepts to be applied for the assignment *New*

Also your solution (C+ and above) must be implemented using program modules (procedures and/or functions).

 

Other submission requirements

  1. Good coding style and documentation:  They will play a role in determining your final grade for this assignment.  Your grade can be reduced by a letter step e.g., "A" to "A-" for poor programming style.

  2. Submitting your assignment: Run a script and within that script clearly demonstrating all the features that you have implemented (refer to part of the handout that dealt with the running of typescripts in the original assignment submission guidelines).

 

Required test cases:

You must run the following test cases in order to receive credit for your assignment:

            Present CD's by artist: Present all CD's that were produced by Kylie Minogue
            Present CD's by rating: Present all CD's that received a rating of 4 or higher
            Present CD's by category: Present all dance CD's.             Title: TOP GUN: THE EXTENDED SOUNDTRACK           
            Artists: Various artists           
            Price: 29.99     
            Rating: 5
            Category: P

Failing to run the test case without the required data may result in a student not receiving credit for that feature.

 

Suggested Approaches to this Assignment:

1) Start early! As was the case with the last assignment, this is another tough assignment.  There's a lot of new concepts that you have to understand and apply in order to complete the assignment requirements.

2) Take it in small steps.  Get the basic program working before you start working on the additional features.  Make sure it really works by testing it!  

3) Back up your work!  Once you get your basic program working make a backup copy (e.g., at Unix type 'cp a7.p a7.basic'.  As you complete additional features backup these versions and don't touch the backup and when you start working on more features modify only the copy.

4) Do attempt this assignment.  Although it isn't worth a large percentage of your final grade, writing these programs really helps you to truly understand the concepts that you were taught in lecture.

5) Addendum to point 4 - while it is important to try this assignment both for the learning and the marks don't fall into the other extreme and spend all your time on these last two assignments worth 12% and no time studying for a final exam worth 40%.

References

Much of the information about the CD's came from the following two web sites:

  1. Amazon: www.amazon.ca

  2. Chapters: www.chapters.ca