CSC 270 - Survey of Programming Languages

Assignment #17 - Avoiding the speed trap

Due Wednesday, November 22, 2017

You are driving down the highway when you realize that your speedometer is not working. And you are on a highway where the state police give out a LOT of speeding tickets!!

Since you know how many hours you have driven and your odometer (strangely enough) is working, you can calculate how fast you are going. If you have traveled 420 miles in six hours, your speed was 70 miles an hour and you are 15 miles per hour too fast!!

Write a program in Scheme to calculate how many miles per hour over the speed limit (of 55 mph) you are driving given the miles traveled and hours traveled. (If you are under the speed limit, it will be a negative number.

Speed (in miles per hour) = Distance(in miles) / Time Traveled (in hours).

Run the program using Dr. Scheme for:

Distance TraveledTime Traveled
85 2
854
956
958
602
604
906
1008
952

[Back to the Assignments Index]