CSC 160 Fall 2014 - Homework 3 (100 points)
Assigned Sept 22, due MON Sept 29

1) Assignments submitted on Moodle with time stamps during class time (Mon or Wed 4:15-5:30pm) will be given a grade of ZERO.
2) 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.
3) 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.


[40 pts.] Chapter 3A
  • Read Sections 3.1-3.4 of the textbook.
  • Do the following exercises in DrRacket:
    3.3.3, with the specific instructions given here:
          a) Define a variable named solid-green-box whose value is a solid green rectangle. Use a width of 10 and a height of 20.
          b) Define a variable named outline-blue-box which is what it sounds like. Use a width of 10 and a height of 20.
          For parts c and d, use only the variable names. Do not use the pictures of the rectangles or the expressions using the rectangle operation, or only half credit will be given.
          c) Write an expression to put the solid box above the outline of a box.
          d) Create a two by two checkerboard where the upper left and bottom right corners have the solid box, and the upper right and lower left corners have the outline of a box.
    3.4.4: Write the function contracts for ellipse, circle, and star-polygon only. For each argument, include its data type then describe what that argument is in parentheses. (Make sure this exercise is commented out, as discussed in Sections 3.4.3-3.4.4 of the text.). Note: The contract for triangle is omitted from this exercise.
  • Save the Definitions Pane to your computer or flash drive with the filename "ch3aLASTNAMEdef.rkt".
  • Save the Interactions Pane to your computer or flash drive with the filename "ch3aLASTNAMEint.rkt".
  • Upload the file to Moodle, using the link for HW3. (Do not click Send for Marking yet, so that you can upload the rest of this assignment!)

    [40 (+15) pts.] Chapter 3B
  • Read Sections 3.5-3.7 of the textbook.
  • Do the following exercises in a single Interactions Pane. For each exercise, type a verbal description of the expected answer in quotation marks, after writing the expression and before pressing Enter:
    3.5.2: Write an expression that chops the bottom 25 pixels off the picture of a face. (Note: You may use any picture of a person's face for this question. It does not have to be the picture in the textbook.)
    3.5.4: Write an expression which produces the bottom 45 pixels of an outlined circle of radius 30. (Hint: A circle's width and height are each twice the radius.)
    3.5.9: Write an expression that produces the picture of someone' face with the caption "Wanted!" in red near the bottom. (Note: You may use any picture of a person's face for this question. It does not have to be the picture in the textbook.)
    (EXTRA CREDIT) 3.5.8: Write an expression, using place-image, to produce a solid blue rectangle 80x50 with a solid orange rectangle 30x20 whose bottom-left corner is at the center of the blue box.
  • Save the Interactions Pane to your computer or flash drive with the filename "ch3bLASTNAMEint.rkt".
  • Upload the file to Moodle, using the link for HW3.

    [20 pts.] Chapter 3C
  • Read Sections 3.8-3.10 of the textbook.
  • Do the following exercises on paper:
    3.8.0: Draw a box diagram around your solution to Exercise 3.5.2 to prove that it is a legal expression.
    3.8.2: Draw a box diagram to prove that (define tri (triangle 15 "solid" "orange")) is a legal expression. Assuming that tri is not already defined.
  • Submit on paper in class by the due date OR on Moodle with the filename "ch3cLASTNAMEbox".



    GRADING
    Question Point Value
    3.3.3 25
    3.4.4 15
    3.5.2 10
    3.5.4 15
    3.5.9 15
    3.8.0 10
    3.8.2 10
    X-CR: 3.5.8 +15
    Total 100 + 15




    Last Modified: 9/17/14