CSC 160 Homework 4

Assigned Sept. 30, due Oct. 17

For all the programming assignments, be sure to follow the design recipe. Write your function contract, examples, and function definition in the Definitions Window, save it to a file, and send me this file (or use the "Handin" button). Be sure to test your functions in one of the following ways:

  1. Write examples in comments in the definitions window, and then after you've defined the function, type those examples into the interactions window and see what they do. Save the resulting interactions window to a file and turn this file in along with your program.
  2. Write examples, not in comments, in the definitions window, insert your function definition before them, hit "Execute", and see what happens. Save the resulting interactions window to a file and turn this file in along with your program.

Be sure to choose meaningful names for functions and parameters, and watch for opportunities to re-use functions you (or the textbook) have already written.

Also turn in a log of how many errors of different kinds you encountered in the assignment, with brief comments describing each one. You may do this using the PSP forms, or simply by keeping track in a text file and turning it in.

This assignment is to be done in pairs, just like homework 2 and 3 (but with a different partner).

The assignment

Grading standards

Error log:       /15

Function name Contract Examples Definition Test results
check-guess /5 /5 /10 /5
check-guess3 /5 /5 /10 /5
check-color /5 /5 /10 /5
modified check-guess /5 /5 /10 /5
who-won, basic version /10 /10 /20 /10
who-won, extra credit   /5 /10 /5
count-votes-4 /10 /10 /20 /10
4-votes->winner /5 /5 /10 /5

General skills:

Following directions /20
Writing contracts from word problems /20
Choosing examples /20
Choosing names /20
Coding /20
Code re-use and choice of auxiliaries /20

Total:         /360 +     /20 extra credit


Last modified:
Stephen Bloch / sbloch@adelphi.edu