Assignment 1
Due Date Thursday 5/9 at 10:00pm
Purpose To write simple functions.
For this assignment and all future assignments you must upload one .rkt file in the specified language at the top of the assignment to the Handin Server . Failure to do so will result in a 0. No exceptions. This will be an individual assignment. The first few assignments will be individual and future assignments will be submitted with lab partners (to be assigned in lab).
Finger Exercises You are not required to submit your finger exercises but they will be helpful so we recommend doing them anyway.
Exercise 1 Exercises 1-4 in HtDP
Graded Exercises
Exercise 2 Write a BSL function that squares a number and adds 5 to it.
Exercise 3 The following table describes how far a person has gone in a race in a certain amount of seconds:
t =
1
2
3
4
5
6
7
8
9
10
d =
2
5
8
11
14
17
20
23
?
?
Write a function that predicts, based on this data, how far they will have run at time t. Write three check-expects: two that test to see the data in the table matches your function’s output, and then one more that tests the output when t is at least 9.
Exercise 4 Take a look at the figure below, which is a graph of f, a function of x.
Turn the graph into a table for x = 0, 1, 2 and 3. The table can be very simple and should resemble the table above in Exercise 3. Comment it out in your .rkt file.
Formulate a BSL function definition for f.