CSC 160 Fall 2005 Homework 4
Assigned Oct 14, extended to WEDS Nov 2
Read Chapter
5 of the textbook (pages 46 to 49).
Read the article on Pair
Programming.
Submitting this Assignment
--You may complete this assignment alone or in pairs.
--For each function, be sure to follow the design recipe. Write all the
function purposes, contracts, examples, skeletons, and function
definitions in the same Definitions Window. Save as hw4[LastName]Def.scm.
--Also test each program. Save the resulting Interactions window as
hw4[LastName]Test.scm.
--If you do the assignment in pairs, include both last names in each
file name.
--Send an email to Wittenstein@adelphi.edu.
Be sure to include your name(s)!
The Assignment
1) Write a function named full-name which takes someone's first
name and last name (both as strings) and returns their full
name.
2) At Exit 17, the speed limit on the Southern State Parkway is 55
mph. Develop a function named radar which takes someone's speed
in mph and returns one of the following symbols: 'under-limit,
'at-limit, or 'over-limit, based on that person's speed.
3) Three candidates (Athena, Barbara, and Chris) are running for mayor
of Schemeville, which, by court order, has a new computerized
voting system. Develop a function named who-won which takes in
three numbers (the number of votes for Athena, the number of votes
for Barbara, and the number of votes for Chris, respectively) and
returns a string indicating the name of the person who won --
either "Athena", "Barbara", or "Chris". For example,
(who-won 7 4 5) "should be" "Athena"
(who-won 5 11 36) "should be" "Chris"
Note that the number of votes cannot be a decimal, a fraction, or a
negative.
For full credit, you may assume that there are no ties. For
extra
credit, come up with a way to handle ties.
| Grading |
Purpose |
Contract |
Examples |
Skeleton |
Template |
Definition |
Testing |
| Question 1 |
/3 |
/3 |
/3 |
/3 |
|
/15 |
/3 |
| Question 2 |
/3 |
/3 |
/3 |
/3 |
/5 |
/15 |
/3 |
| Question 3 |
/3 |
/3 |
/3 |
/3 |
/5 |
/15 |
/3 |
Last Modified: 11/1/05