CSC 160 Fall 2007 - Homework 10
Assigned Dec 7, due SUNDAY Dec 16


Log the time you spend on this assignment using a log sheet with all the same columns as the one attached to the PSP Chapter 3 handout. For your convenience, I have attached a blank Microsoft Excel copy of it here.

Do the following exercises in DrScheme on your own or in pairs (using the ideas in the Pair Programming article):
  • Use the Design Recipe v2 to develop the function square-root. It takes in any object.
    A) If the object is a non-number, it returns a message saying "Cannot take the square root of a non-number."
    B) If the object is a negative number, it returns a message 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.

  • Exercise 5.1.2 from How to Design Programs: Use Design Recipe v2 to develop the function check-guess, which takes in two numbers, guess and target. Depending on how guess relates to target, the function produces one of the following three answers: "Too Small", "Perfect", or "Too Large". Be sure to show ALL Design Recipe steps (including Data Analysis) and at least 3 well-chosen examples.
  • Since you are working with strings and not symbols, the remainder of the question involving check-with-gui will not work, so just do the part of the question I state here.

  • 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 your Definitions Pane, Interactions Pane, and Log Sheet, using the Digital Dropbox in the Tools menu on Blackboard. Be sure to include your first and last name(s) in the Name Box on Blackboard, and click Send File (not Add File)!

    The file name for the Definitions Pane needs to be "hw10[section][LastName]Def.scm" where:
  • [section] is replaced by -01 for the 9am class and -02 for the 10am class.
  • [LastName] is replaced with your last name(s).
  • For example, if I were submitting this assignment and I were in the 10am class, I would name the file "hw10-02WittensteinDef.scm".

    Similarly, the file name for the Interactions Pane needs to be "hw10[section][LastName]Int.scm", and the file name for the Log Sheet needs to be "hw10[section][LastName]".

    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
    square-root 45
    Contract 3
    Purpose 3
    Data Analysis 10
    Examples 6
    Skeleton 3
    Function 15
    Interactions Pane 5
    check-guess 45
    Contract 3
    Purpose 3
    Data Analysis 10
    Examples 6
    Skeleton 3
    Function 15
    Interactions Pane 5
    PSP Log 5
    Filenames 5
    HtDP 5.1.5 +20
    Total 100 + 20




    Last Modified: 12/10/07