CSC 160 Fall 2008 - Homework 9
Assigned Nov 17, due MONDAY Nov 24


Reread Chapters 12 & 14 of the textbook.

Read Sections 15.1-15.5 of the textbook.

Do the following exercises in DrScheme on your own or in pairs (using the ideas in the Pair Programming article):
  • Exercise 12.2.2: Define a function named big? that takes in either a number or a string, and tells whether the argument is big. What does big mean? For numbers, it means at least 1000, and for strings, its any string of length 10 or more.

  • Use the Design Recipe v2 to develop the function square-root. It takes in any object and does the following:
    A) If the object is a non-number, it returns an error message using the error function saying "Cannot take the square root of a non-number."
    B) If the object is a negative number, it returns an error message using the error function saying "Cannot take the square root of a negative number."
    C) If the object is a nonnegative number, it finds the square root of a number (using sqrt).

  • Be sure to show ALL Design Recipe steps (including Data Analysis) and at least 3 well-chosen examples.

  • EXTRA CREDIT (20 points): Use Design Recipe v2 to do exercise 5.1.5 in How to Design Programs. Replace all the symbols by strings in the exercise. Skip the last 3 lines involving the master.ss teachpack.


    Submitting your Assignment
    Please submit this assignment in a single Definitions Pane and a single Interactions Pane through Moodle. Points will be deducted for completing the assignment with multiple Definitions and/or Interactions Panes.

    Be sure to include your first and last name as a comment in the first line of both your Definitions Pane and Interactions Pane.

    The file name for the Definitions Pane needs to be "hw9[LastName]Def.scm" where:
  • [LastName] is replaced with your last name(s).
  • For example, if I were submitting this assignment, I would name the file "hw9WittensteinDef.scm".

    Similarly, the file name for the Interactions Pane needs to be "hw9[section][LastName]Int.scm".

    Please let me know if this is not clear or if you are unsure exactly what filename to use. Part of your grade is using the correct filenames.


    GRADING
    Question Point Value
    12.2.2 50
    Contract 3
    Purpose 3
    Data Analysis 5
    Examples 10
    Skeleton 3
    Inventory 3
    Function 20
    Interactions Pane 3
    square-root 50
    Contract 3
    Purpose 3
    Data Analysis 5
    Examples 10
    Skeleton 3
    Inventory 3
    Function 20
    Interactions Pane 3
    HtDP 5.1.5 +20
    Total 100 + 20




    Last Modified: 11/11/08