University of Calgary

Maintaining An Audio CD Library

Maintaining An Audio CD Library
source: Katrin Becker, 1997

The object of this assignment is to write a program that will build and maintain a list of CDs that you own. An existing list is read in from a user-named file and sorted into alphabetical order. The user of the program may then make one of two requests:

listall : print out the entire mailing list sorted alphabetically by artist formatted as follows:

    Creed                  
      My Own Prison
    Wind-Up Records Inc.
    Attic Records limited
    1997         AACD 1500

year : given a year (of the form yyyy), print out a sorted list of all CDs you own that were released in the given year.

The original data is in a text file called CDs.long ( there is also a shorter version in CDs.data) and each 'data record' has the following format:

- you may assume input is valid
- there is one field per line
- "blank" fields (=data unknown) are entered as '--' (2 dashes)
- In some cases the producer and distributor are the same. When this is the case, the producer is listed but the distributor may simply be enetered as '..' (2 dots)

Artist
Album Title
Producer
Distributor
Year Released
CD-Code
Eg.
Creed
My Own Prison
--
..
1997
ACD 1500

Each record will follow the next with exactly one blank line.

A working version of this assignment is available in the course directory for you to try so you can see how it works.

Minimal requirements for this program:

To meet the minimal requirements your program must be able to read a single (possibly long) list of CDs from a specified file, and then be able to process the following interactive requests:

1. listall : print out the entire CD list sorted alphabetically by artist
2. year 1974 : given a year (of the form yyyy), print out a sorted list of all CDs released in the given year.

Once the inventory has been created it is to be written to a file (whose name is given by the user) so that the next time the program is run it can use this file as it's input file. This means the format of the output file must be the same as the original data file.

Bonuses (caution: some of these bonuses are quite involved):

1. Include one or more of the following added features:

a   : add a CD to the list;
r   : remove a CD from the list;
x  : purge (remove all 'deleted' CDs);
b  : print labels (format output so it will fit on pre-fab label sheet)
n  : start new list (i.e. discard, or save and discard the old one)
c  : change some of the information for a CD (i.e. allow 'editting')

2. Set up the user interface menu-style allowing the user to choose one of several 'command' options' (like those listed above)

3. Allow the user to enter new CDs from the terminal instead of from a file. [both options must work in the same program but not during the same run]

The program must be fully documented and follow appropriate style constraints. You must provide sufficient evidence that the program compiles and executes correctly.



Updated: August 31, 2005 01:50 PM