CSC 160 Fall 2013 Homework 14 (60 points)
Assigned Dec 9, Due MONDAY Dec 16

1) This assignment will NOT be accepted late for any reason, since solutions will be posted to Moodle Tuesday morning (12/17).
2) In the spirit of the pair programming article that you read and summarized in HW6, this week's homework assignment may be done in pairs. If you choose to work in pairs, you must find time outside of class to work together in person at one computer. As per the syllabus, you cannot "pair-off" with the same person more than once during the semester. If you choose to do the assignment in pairs, please submit one copy through Moodle where both last names are used in each file name and both names appear as a comment at the top of each pane (Definitions and Interactions).
3) Start this homework as soon as possible so that you have time to get any help you may need from the instructor or course tutor prior to when the assignment is due.
4) Do not start the exercises until to have fully read and fully understood the corresponding textbook sections. If there is something you do not fully understand, you must contact the instructor or course tutor prior to starting the assigned exercises.


Assigned M 12/9
Textbook Reading (to review today's class):
  • Read Sections 20.1-20.4 of the textbook.

    Do the following exercises in DrRacket (show all Design Recipe v2 steps whenever you design a function, including a sufficient set of test cases for all functions and a Data Analysis for functions that return booleans):
  • Design the function: on-top?. It takes a point and returns true if it is in the uppermost 50 pixels of the window.
  • Exercise 20.4.2: Design the function: above-diagonal?. It takes in a posn and returns true if the point is above the diagonal. [Hint: In Racket, the diagonal goes from the top left corner (also known as the origin) to the bottom right corner.]
  • Extra Credit - Exercise 20.5.3: Design a function named scale-posn which takes in a number and a posn, and returns a posn formed by multiplying the number by each of the coordinates of the input posn. For example, (scale-posn 3 (make-posn 2 5)) "should be" (make-posn 6 15).


  • Submitting your Assignment
    You are required to submit this assignment in a single Definitions Pane through Moodle. Points will be deducted for completing the assignment with multiple Definitions Panes.

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

    The file name for the Definitions Pane needs to be "hw14[LastName]Def.rkt" where:
  • [LastName] is replaced with your last name.
  • For example, if I were submitting this assignment, I would name the file "hw14WittensteinDef.rkt".


    Grading Contract
    & Purpose
    Data Analysis Examples Skeleton
    w/Inventory
    Add details
    to skeleton
    Fill in the
    function body
    30 points: on-top? /3 /3 /3 /3 /3 /15
    30 points: Exercise 20.4.2 /3 /3 /3 /3 /3 /15
    Extra Credit: 20.5.3 /2 n/a /2 /2 /2 /12



    Last Modified: 12/9/13