Exercise #2

The exercise is to write a Scheme program, containing definitions for one or more Scheme procedures, that compares the average earnings of American production workers with the costs of basic goods and services in several recent years, leading to an answer to the question, ``In which of those years was the purchasing power of a typical production worker at its highest level, and in which was it at its lowest level?''

Here is a short table containing the data you'll need. Each row contains information about a particular year, which is identified in the first column. The second column shows the average weekly earnings, in dollars, of production workers (including mining, manufacturing, and construction workers and non-supervisory workers in transportation, public utilities, wholesale and retail trade, finance, insurance, real estate, and service industries). The third column in each row gives the annual average Consumer Price Index (CPI), a measure of the prices of such basic goods and services as food, clothing, shelter, fuel, transportation fares, medical treatment, and prescription drugs. The CPI is not measured in dollars, but as a percentage of the prices of the same selection of goods and services in some ``base period,'' currently 1982-1984.

1970 $119.83 38.8
1975 $163.53 53.8
1980 $235.10 82.4
1985 $299.09 107.6
1987 $312.50 113.6
1988 $322.02 118.3
1989 $334.24 124.0
1990 $345.35 130.7
1991 $353.90 136.2
1992 $363.61 140.3
1993 $373.64 144.5
1994 $386.21 148.2
1995 $393.99 152.4
1996 $405.92 156.9
1997 $416.84 160.5

(My source for these data is the Bureau of Labor Statistics of the United States Department of Labor.)

The same data can be assembled into a list of lists in Scheme, to which I'll give the name labor-statistics:

(define labor-statistics
  '((1970  119.83   38.8)
    (1975  163.53   53.8)
    (1980  235.10   82.4)
    (1985  299.09  107.6)
    (1987  312.50  113.6)
    (1988  322.02  118.3)
    (1989  334.24  124.0)
    (1990  345.35  130.7)
    (1991  353.90  136.2)
    (1992  363.61  140.3)
    (1993  373.64  144.5)
    (1994  386.21  148.2)
    (1995  393.99  152.4)
    (1996  405.92  156.9)
    (1997  416.84  160.5)))

The ratio between a person's weekly earnings and the Consumer Price Index is a rough indication of the person's ability to afford essential goods and services: When this ratio increases, a person can afford them more easily; when it decreases, less easily.

Write a Scheme program to determine the years, from among those listed, in which the maximum and minimum values of the ratio just described were reached, and what those maximum and minimum values were.


This document is available on the World Wide Web as

http://www.math.grin.edu/courses/Scheme/spring-1998/exercise-2.html

created February 4, 1998
last revised June 21, 1998

John David Stone (stone@math.grin.edu)