Computer Science 15-100 (Sections T & U), Spring 2008
Homework 7c
Due:  Tue 4-Mar-2008 at 3:00pm (online submission) and at class (physical copy)
(no late submissions accepted).



  1. Checkerboards
    Write a method that takes a page and a bounding box and draws a red-and-black 8-by-8 checkerboard (with a red square in the top-left) that fills the given bounding box (fill it completely, so that the width of the cells may differ from their height).  If either the width or height of a cell would be smaller than 2 pixels, do not draw the checkerboard, but instead draw a single magenta rectangle filling the entire bounding box.  Using this method, draw two checkerboards -- one in the top-left and another in the bottom-right quadrants of the window.
     
  2. Steelers Logos
    First, write a method that takes a page, a color, a center point (cx,cy), and a radius, and -- using the technique we covered in class -- draws a single astroid (the type of hypocycloid in the Steelers logo) in the given color that is just contained by the circle with the given center and radius.  Here is a picture of an astroid drawn in this manner, with about 10 points on each positive or negative coordinate axis:


    Next, write a method that takes a page, a center point (cx,cy), and a radius, and -- using your astroid-drawing method -- draws a Steelers logo just contained by the circle with the given center and radius.  Here is a picture of a Steelers logo:

    Note that you do not have to exactly color match (use built-in colors), and you do not have to exactly match the font (but you should use a bold font, at least), and you do not have to exactly place the "Steelers" string (do an ok job, but we have not learned how to center or otherwise accurately place strings, so "close" is close enough for this problem).  This assignment is about methods, loops, and conditionals, and not about strings, so do not spend too much time perfecting how the string looks!

    Finally, use this Steelers-logo-drawing method as follows:
  3. Study your classmates mystery methods
    In hw7b, you were asked to write mystery methods (describable in English) and code snippets (for tracing).  Here, you are provided with these -- both yours and your classmates -- as an excellent opportunity to study for the upcoming test.  This exercise is peculiar in that the answers are provided for you.  WHAT TO TURN IN:  A statement (based on the honor code, and included as a comment just after your name at the top of the program you submit) indicating how much time you invested in this exercise.  For this part of the assignment, each minute you invest earns 2% of the credit, up to 100% for 50 minutes.  Again, there is nothing to submit beyond this statement of time invested.

    Student-authored mystery methods are here:  Hw7c-students.zip

Carpe diem!