Name: ________________________________________ COMPUTER SCIENCE PROGRAM SETS 6W3


  1. Add Text boxes to each of the problems in program set 1 (sample code) to describe the output content.
  2. You must have at least 3 function calls for each of the 4 programs you typed.
  3. Test yourself by writing the functions by your self without looking at the code until the process is mastered.
  4. You will have 2 of these functions to write on your programming test tomorrow plus one other math formula.
  5. Added program:


1. Click on the TeachPak link and study the explanation. Then complete programs for Exercise 2.2.1 through 2.2.5.

  1. Use the 4-corner design recipe to help develop a solution
  2. Follow the design recipe in section 2.5 showing the contract, purpose and header.
Exercise 2.2.1. 

Exercise 2.2.2.

  • Define the program dollar->euro, which consumes a number of dollars and produces the euro equivalent. Use the currency table in the newspaper to look up the current exchange rate.
  • Define a second program that uses the currency of your origin.
  • Test both using $100 and $150
  • Exercise 2.2.3.

    Exercise 2.2.4.

    Exercise 2.2.5.

    A typical exercise in an algebra book asks the reader to evaluate an expression like N/3 + 2 for n = 2, n = 5, and n = 9. Using Scheme, we can formulate such an expression as a program and use the program as many times as necessary. Here is the program that corresponds to the above expression: (define (f n)

     	    			(+ (/ n 3) 2))

    First determine the result of the expression at n = 2, n = 5, and n = 9 by hand, then with DrScheme's stepper.

    Next, formulate the following three expressions as programs:

    1. n2 + 10
    2. (1/2) n2 + 20
    3. 2 - (1/n)

    Determine their results for n = 2 and n = 9 by hand and with DrScheme.


    1. Draw some more shapes and write functions to calculate the area and perimeter of those shapes; for example, a parallelogram, a trapezoid.
    2. Write a function that draws a ring that consumes the inner and outer radius.