Check for Mistakes in this Word Problem: late-to-class?
Directions: You will be late to class if you have to walk more than 25 pixels to get there. Write a function that takes in your x-coordinate and y-coordinate and the x-coordinate and y-coordinate of the classroom and returns true if you will be late to class and false if you will be on time.
Contract and Purpose Statement
Every contract has three parts ...
;
late-to-class?:number number number numberboolean
;
Takes the coorindates of my location and a classroom and returns true if the distance is more than 25 and false if it is less than 25.
Examples
Write some examples, then circle and label what changes ...
(EXAMPLE (
(late-to-class? 40 55 65 80))(> 25 (distance 40 55 65 80))
(EXAMPLE (
(late-to-class? 40 55 65 80))(< 25 (distance 40 55 65 80))
Definition
Write the definition, giving variable names to all your input values ...
(define (
late-to-class?student-x student-y school-x school-y)((< 25 (distance student-x student-y school-x school-y))))