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 :
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:
Feet | Inches |
---|---|
5 | 2 |
5 | 4 |
5 | 6 |
5 | 8 |
6 | 1 |
6 | 2 |
4 | 6 |
3 | 108 |