Exercise #2

Two teachers, Ms. Britten and Mr. Rice, are teaching the same course to different classes of students at the same school. They want to compare the performance of their students, but there is a small problem: Ms. Britten scores her students' papers on a scale from 0 to 100, with 70 being the minimum passing score; Mr. Rice uses the four-point scale in which grade-point averages are usually presented, running from 0.00 to 4.00, with 1.00 as the minimum passing score.

The two teachers agree on a general method for converting scores from one scale to the other: Scores in the range from 0 to 70 on the hundred-point scale should be converted linearly into scores in the range from 0.00 to 1.00 on the four-point scale, and vice versa; for instance, a score of 62 on the hundred-point scale is equivalent (well, approximately equivalent) to a score of 0.89 on the four-point scale, since 0.89 is 62/70ths of the way up from 0.00 to 1.00. Similarly, scores in the range from 70 to 100 on the hundred-point scale should be converted linearly into scores in the range from 1.00 to 4.00 on the four-point scale; for instance, a score of 95 on the hundred-point scale is equivalent to a score of 3.50 on the four-point scale, since 95 is 25/30ths of the way up from 70 to 100, and 3.50 is 25/30ths of the way up from 1.00 to 4.00.

Define and test two Scheme procedures that implement this method of converting scores. One of them, Britten-score->Rice-score, is for Mr. Rice to use when he converts Ms. Britten's students' scores into his own four-point scale; it takes one argument, which should be in the range from 0 to 100, and returns a value in the range from 0.00 to 4.00. The other procedure, Rice-score->Britten-score, is for Ms. Britten to use when converting Mr. Rice's students' scores into her hundred-point scale; it too takes one argument and returns one numeric value.

I encourage you to include additional test runs if they demonstrate surprising or elegant features of your procedures or document their limitations.

This exercise will be due at 9 a.m. on Friday, January 30.


This document is available on the World Wide Web as

http://www.cs.grinnell.edu/~stone/courses/scheme/exercises/2.xhtml

Validated as XHTML 1.1 by the World Wide Web Consortium Cascading Style Sheet validated by the World Wide Web Consortium

created January 28, 2004
last revised February 10, 2004

John David Stone (stone@cs.grinnell.edu)