CS132 Midterm Exam Context

Winter 2003. All sections.

Many of the questions on the Winter 2003 midterm exam for CS132 will be drawn from the following program specification. Take the time to read and understand it thoroughly.

Everybody is probably familiar with "The Yellow Pages". It is a large yellow book containing a directory of companies, with phone numbers, addresses, and sometimes advertisements. The Yellow Pages is organized by categories, such as "Electronics", "Groceries", "Pharmacy", etc. Many of the questions on this exam consider an implementation of a computerized version of the Yellow Pages.

Each company listed in the Yellow Pages is associated with a number of categories which describe what kind of business it is. For example, the Future Shop might be listed under the categories “Electronics”, “Large Appliances”, and “Musical Recordings”, because the Future Shop sells all three of these things.

Future Shop
1
2943 King Street North, Waterloo
519 654-3210
Electronics
Large Appliances
Musical Recordings

Zehr’s
2
725 Street E, Kitchener
519 275-1247
Groceries
Pharmacy

HMV
2
225 University Ave, Waterloo
519 662-3456
Musical Recordings

...

Figure 1: A sample data file

Entries in the Yellow Pages database consist of

Companies are separated by a blank line. See Figure 1 for an example.

A program to maintain and access yellow pages data is required. It will be able to do things like read a Yellow Pages data file, search for a company by name or category, print information about a company, and insert or delete a company into the directory. The program should also be able to compute the amount of revenue generated by advertisements, assuming that different levels of advertisements have different costs (for example, level 0 advertisements cost $100, level 1 advertisements cost $300 and level 2 advertisements cost $1000).

This document is not meant to be an exact specification of the operations which are to be implemented, nor is it meant to be a complete list of possible operations. Please study it carefully and think about possible design and implementation issues.