CS212 Exams
Spring 1998 - Prelim
2

OO Programming


The library has hired you to construct an electronic bibliography. Bibliographies are lists of entries. Entries contain information about articles or books. Each entry has a title (a string), a list of authors (a list of strings), and a year (a number). Book entries include an ISBN number, and a publisher (a string). Article entries include a month (a number) and the name of the magazine or journal in which the article appeared (a string). Journal entries also include a volume number, whereas magazine entries include a month (a number).

  1. Draw a class hierarchy for bibliography entries and define Scheme classes that implement this hierarchy.






  2. Write a generic function print-entry which, when given an arbitrary e, prints the slots of e prefixed by the name of the slot. For instance, if the entry is the book A Logical Approach to Discrete Math by D. Gries and F. Schneider, published in 1994 by Springer-Verlag with ISBN number 0387941150, then the output should look like this:
    Title: A Logical Approach to Discrete Math
    Authors: ("D. Gries" "F. Schneider")
    Year: 1994
    ISBN: 0387941150
    Publisher: Springer-Verlag
    Your code should be as small and simple as possible.






Solution

Return to CS 212 Prelim 2 - Spring 1998