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

CPSC 231: Assignment 8 (Worth 6%)

 

New Concepts to be applied for the assignment

  1. Dynamic (linked) lists.

Assignment description

Unless otherwise specified, the requirements for this assignment are identical to the ones described in the previous assignment.

Grades for working assignments:

Basic assignment: C+

Your program reads the information from the input file 'books.dat'  into a linked list (rather than a fixed size array as you did with the previous assignment).  This means that your program should not have an arbitrary limit on the size of the list.  In all other respects the "C+ version" of this assignment should include all the features of the "C version" of the previous assignment (display, load, save and quit).

Extra features: 

Completion of each of these extra features will result in the increase of a "one step" to your grade e.g., 'C+' to 'B-'.  Unless there is a compelling reason to do otherwise you may complete as many of the features below as you wish in whatever combination that you desire.  Successful completion of all six features will make you eligible for an 'A+'.   (You must also fulfill style requirements as well as the general submission assignment requirements).

Feature one (Find additional details about a book):

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

Feature two (Present all books of a certain genre):

This feature allows the user of the program to display the titles of all of the books of a particular genre (alternatively you can get your program to show all titles that were written by a particular author or with a specific rating but since these operations are very similar you will only get a maximum credit of one grade step for this feature regardless of how many criteria that your program can use as presentation criteria).

If you have already completed feature one, then the books will be presented in alphabetical order, otherwise they will presented in the order in which they currently appear in the list.  

Feature three (Insert a book 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 book which will then be added to the end of the list.

Feature four (Remove a book from the list):

Since the user must type in the name of the book in order to indicate which book that he or she wishes to remove from the list you will likely have already completed the 'find' feature first (feature one).  When the collection is displayed after the removal, no information about the book that was removed should be displayed - not even blank spaces. 

Feature five (Write an enhanced Save feature)

In order to get credit for this feature, the program will now use only one data file.  The program will load the site information from the 'books.dat' file.  When the user of the program selects the 'save' option then the program can write the modifications to the 'books.dat' file rather than a separate file.  To get credit for this feature your program must be able to reload the updated information from the modified file.   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 list.

Feature six (Display the list in Opposite order)

In order to receive credit for this feature you cannot use doubly linked lists (don't worry if you don't know what I am referring to because this topic will covered in a later course) but instead you must use a recursive function or procedure call to display the list in reverse order.  That is, the last element is displayed first, the second last element is displayed second until the first element is reached which is displayed last.  Because this features is a 'bonus' you may have to do some extra reading to in order to sufficiently understand recursion to implement it in this assignment.  Consequently I recommend that you work on this feature last, after you've gotten all the other features working because it will likely take up substantially more time than everything else (JT:  Hint it depends upon if you can think and trace code in a somewhat backwards fashion).

Grades for non-functional assignments

D level assignment

The student has invested considerable work in the assignment and the code compiles but it doesn't fulfill any of the above requirements.

D- level assignment

The student has invested considerable work in the assignment but it doesn't compile.

 

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 or more if your submission was implemented using bad style conventions (e.g., "A" to "A-" for employing poor naming conventions for identifiers, insufficient documentation, the use of global variables - other than debugging variables (JT: although it's not explicitly required for this assignment I still recommend that you use them to quickly find the errors) - or for non-modular design).  See the coding style guide for additional details.
  2. Include a README file in your submission:  For this assignment your README file must indicate what grade level has been completed (e.g., B+) as well as the specific features that are working e.g., "I completed all the requirements of the base level assignment plus the ability to display the list in reverse order so this assignment may receive a maximum grade of 'B-' for functionality."  This will allow your marker to quickly determine what he or she must look for and speed up the marking process.  Also you should 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.  Omitting this file will result in the loss of a letter 'step'.
  3. Assignments (source code 'files that end in dot-p' and the README file) must be electronically submitted via submit.  In addition a paper print out of the source code and README must be handed into the assignment drop box for the tutorial that you are registered in (located on the second floor of the Math Sciences building).  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.  Missing the electronic submission will mean that your maximum grade attainable is 'D' or 'D-' (it is very time consuming to mark assignments when you only hand in paper submissions).  Missing the paper printout will result in the loss of a letter 'step'.

Relevant files (Can be found in the Unix directory: /home/231/assignments/assignment8)

  1. Sample executable: 'books'
  2. Data file: You can use the same data file as the one used in the previous assignment.