CSE 143, Homework 3

Library Lists


introduction | objectives | overview | specifications | written work
resources | hints and tips | submission | files | announcements

introduction

In this homework, you will complete a partial implementation of an extended version of the program you wrote for Homework 2 using list ADTs. Even moreso than for past homeworks, a major part of this assignment is understanding provided code and specifications well, so take the time to read both closely and thoroughly. If you understand the provided code and instructions properly, you should find that the code you need to write is neither very long nor complicated.

objectives

The following concepts and technical knowledge are the focus of this homework:

*also known as "vector"

overview

You will complete a partially implemented project which is a new, extended version of the library project you worked on in Homework 2. When complete, this new, extended version will use two list ADT implementations: one to store records of books, and another for records of library patrons.

There are three substantial pieces of code missing in the provided project:

You are provided with a full implementation of the book list class (LibraryBookList), which is an implementation of the (unsorted) list ADT. You should use this as a model for implementing the patron list, which will be similar but sorted by patron name, i.e. sorted order (by patron name) is maintained when items are inserted/deleted. You are also provided with the following complete classes: Date (same as in Homework 2), LibraryBook (not the same as in Homework 2, extended slightly), LibraryPatron.

As in the previous homework, understanding the provided code and what it implies about the sections of code you must fill in will be crucial to the correct, timely completion of the project. A week prior to the final due date for the programming part of this project, you will be asked to submit a static call graph of the whole program (see written work below). Completing the call graph should help you to gain a precise, comprehensive understanding of the code and to plan the missing code you will write.

specifications

Under files below, you are given all of the files needed to build a program that works just like the sample executable, but some of them are incomplete, e.g. function definitions, a class missing. Start by spending some time familiarizing yourself with the sample executable, then make sure to study all of the provided code, because knowing what classes and methods are available to you will be crucial. The provided versions of files you will complete contain comments marked with *** (three asterisks), placed where you are expected to add code. These are intended to guide your programming, often very precisely, and should be taken seriously as supplements to these specifications.

class LibraryPatronList (in lpatrlst.h, lpatrlst.cpp)

Implement this class in the provided files lpatrlst.h and lpatrlst.cpp. The class declaration provided in lpatrlst.h only declares the constructors and a private file I/O method (readFile) for you. The rest of the declaration mainly consists of comments describing each of the methods you should implement. Source file lpatrlst.cpp defines method readFile but is otherwise basically empty.

This homework is larger than past homeworks and provides a good opportunity to learn about software engineering---in this case, how to develop a complex program composed of many pieces of code (e.g. classes, functions, files) in a timely, correct fashion. More specifically, you will complete the homework in two stages. In Part I, you will be focusing on class LibraryPatronList in taking these main steps:

For the Part I due date, you will submit your LibraryPatronList stub implementation (header and source file pair) and a driver program. (In this case, by "driver program", we simply mean a source file which defines a main function whose purpose is to comprehensively test the class. See under resources and hints and tips for more review on stubs and drivers.) Your driver should instantiate LibraryPatronList instances using each constructor at least once and call each public method at least once for testing coverage.

Your stub implementation of LibraryPatronList must build successfully, but the methods do not have to work the way they are supposed to. (The whole point of a stub implementation is to enable you to build a project with an incomplete part, writing code and testing gradually, progressing in small, controlled steps.) This means that your test driver might not do anything very interesting at this stage, perhaps just produce some output signalling that certain methods have been called. However, as you replace your stubs with complete implementations, the hope is that this driver will be useful for testing and debugging.

For the Part II due date, you will complete the LibraryPatronList implementation, as well as the processTransaction and main functions, as described next. The result should be a multi-file project that builds into an executable that works just like the sample program. Part II requires that you submit lpatrlst.h, lpatrlst.cpp, library.cpp, and main.cpp.

function processTransaction (in library.cpp)

Study library.cpp and its corresponding header, and make sure you understand the purposes of the functions defined and declared in these files. The only part of library.cpp you should need to modify is the definition of function processTransaction. A detailed outline of the definition is provided in the comments. From this outline and the other provided code, you should be able to deduce how you should be using the various Library classes in this function.

function main (in main.cpp)

As with processTransaction, you are provided with an empty definition for main. Define main using the comments as a guideline, calling functions declared in library.h and using the list classes appropriately. The resulting function should not be very long---the whole file, main.cpp, should end up being a page and a half long or less.

additional requirements

Finally, make sure you do not modify the following files:

written work

static call graph (for Part I)

For Part I's paper submission, in addition to a project report and your web turn-in receipt print-out, you should submit a static call graph that includes all of the functions and member functions that can be called, starting from main (not your driver.cpp's main definition, but main.cpp's main definition). (Do not include implicit constructor invocations---your graph will be cluttered enough without them.)

At the time you submit Part I, you might not have completed main.cpp yet, but you should be able to deduce (from the commments and provided code) what functions and methods will be called.

Your call graph will end up being rather large and complicated, so we strongly suggest you write on a large sheet of paper and start with main in the middle. To save space, remember to write only function/method names on the graph, omitting parameter lists. For a method name, remember to include the class name using :: notation. For example, if main happened to call LibraryBookList's isEmpty method, you'd write "LibraryBookList::isEmpty" on your call graph and draw an arrow from "main" pointing at it.

Please write small but neatly, fold your call graph into a reasonable size (e.g. 8.5 x 11 inches) for submission, and make sure your name, student number, and section are written in a visible location.

project report (for both Part I and Part II)

In addition to your turn-in receipt print-out, you are required to submit the following on paper with each of the two parts' submissions. This may be handwritten if it is 100% legible. If your TA can't read it easily, he may require you to resubmit it word-processed. It must be on a separate sheet of paper, and not embedded in comments in the program. Please write your name and section on the sheet.

  1. It may be that your project does not meet the specifications given above. Write a short statement that either says you are in full compliance with the requirements, or lists the ways in which you are not (things that don't work, etc.).

  2. You may decide that the program you turn in is not ideal in some respects. If your boss or fellow programmers were looking at it, what do you think they would find to like or dislike? Write a short paragraph evaluating the project. You could focus on the way it's designed and programmed, or focus on what usefulness the program has.

  3. Write a statement of acknowledgements. If you took code from anywhere (except what the assignment gives you directly), say where you got it from and who the original author is. You must do this even if you modified the code considerably. If you received help on the assignment from anyone other than course staff (TA, instructors, consultants), please list the name of the person and the extent of their help.

resources

hints and tips

submission

As always, be sure to read the official homework submission policy, linked on the course web on the Homework page. For each of the two parts, you will have to submit your work (1) via the web using the page linked below and (2) on paper.

Your web turn-in for Part I should consist of the files listed below. The form will not accept any other files.

Your web turn-in for Part II should consist of the files listed below. The form will not accept any other files.

Your paper submission for each part should consist of the following:

As stated on the official homework submission policy page, all parts and pages of your paper submission must be stapled together and sealed in a large envelope. (Don't expect the TA to have a stapler in section, either!) You can lose points for not following these instructions (crazy, but true!) For this homework, you will submit your paper submission in quiz section on the due date at the top of this page.

files


announcements

If any clarifications or changes need to be made for this homework, they will be posted to the cse143-announce e-mail list and linked here.


Return to main Homework page...
Last modified: Sat Jul 22 11:17:51 PDT 2000

Save paper. Read documents on the web and, if you must print, print two-sided. Recycle this when you're done.