Assignment 1: Conditionals and Symbols (due Sept 8)
Before you tackle the homework, remind yourself of our
General Advice,
Advice on Homeworks,
and
Grading Guidelines.
Above all, keep your work neat and honest.
 (3 pts) Evaluate each of the following expressions. Show every
step. For example:
(sqrt (+ (* 3 3) (* 4 4)))
= (sqrt (+ 9 (* 4 4)))
= (sqrt (+ 9 16))
= (sqrt 25)
= 5
Check your work with the stepper.
 (zero? ( 3 3))
 (or (< 4 3) (and (= 5 (+ 2 3)) (> 8 0)))
 (and (+ 6 2) false)
 (or (zero? (+ false 9)) true)
(cond [(> 5 0) 'positive]
[else 'negative])
(cond [(and (symbol=? 'hi 'bye)) 5]
[else (= 8 (* 2 4))])
(cond [(/ 9 4) 'divided]
[(+ 9 4) 'added]
[else 'neither])
 Given
;; experiment : number > number
(define (experiment t)
(cond
[(< t 0) 0]
[(> (distance t) 500) 500]
[else (distance t)]))
;; distance : number > number
(define (distance t)
(* 1/2 t t G))
;; G : gravitational acceleration
(define G 9.81)
what are the results of
(experiment 7)
(experiment 5)
(experiment 15)
Type the steps into the Definition window and check them. You may wish to
use several files and print them separately.
 (3 pts) Exercise 4.1.3 in the text.
 (6 pts) (Adapted from an ECON 211 assignment) The labor supply in
three neighboring counties is as follows: Winston County has 300 hours of
labor supply, Marvin County has 500 hours of labor supply, and Atlantic
County has 650 hours of labor supply. The labor in these counties produces
two crops: corn and wheat. Producing each bushel of corn requires 3 hours
of labor. Producing each bushel of wheat takes 2 hours of labor.
 Write a program supply that returns the labor supply for a
given county (represent the county name with a symbol).
 The corn produced in a given year depends on the amount of rain a
county receives. If a county gets under three inches of rain, they can
produce 60 bushels. If they get at least three but less than seven inches
of rain, they can produce 100 bushels. If they get seven or more inches of
rain, they can produce only 40 bushels. Write a program
cornyield which takes an amount of rain and returns the number of
bushels of corn produced.
 Write a program wheatyield which takes a county name and the
amount of rain that county received and returns how many bushels of wheat
that county's labor supply can produce.
Remember to reuse previous programs when possible.
Kathi Fisler 
This page was generated on Fri Aug 27 17:01:35 CDT 1999.
