CSC 270 - Survey of Programming Languages

Assignment #19 - Converting feet and inches into inches

Due Monday, December 4, 2017

Normally, we state height in feet and inches. For example, I'm 5 feet 11-3/4 inches. But if I want to compare my height to someone under 5 feet, such as my son who is 4 feet 1 inch, it is easier to work purely in inches.

The conversion is :

Height (in feet and inches) = feet * 12 inches per foot + inches

Write a program in Scheme to calculate that accepts a length or height in feet and inches and convert it into inches For example, if you type n the interactions windows:

     (total-inches 5 11)
it will print on the line below
      71

Make sure that your program tests to see that the number of inches is in the range 0-11!!.

Make sure that your program tests to see that both parameters are numbers!!.

Run the program using Dr. Scheme for:

FeetInches
5 2
54
56
58
61
62
46
3108

[Back to the Assignments Index]