CS 120   Fall 2016,  Instructor:  Jeffrey Horn
 

 Assignment 7:   "Graph Paper"


  • Handed out:  Tuesday, October 25, 2016
  • Due:    Monday, November 7, 2016
  • Purpose:  Learn
    1. More Java graphics
    2. More for loops
    3. Nested loops
    4. Private methods that take Graphics objects
  • Example Code:   (in class)
  • DETAILS:
    1. Make two methods:  one that draws traditional (i.e., solid lines) graph paper, and one that draws "Dortmund style" graph paper.
    2. Both types of graph paper should be annotated along the left and the top margins, with numbers indicating pixels.
    3. Here are the method signatures you MUST use!
      • private void drawQuadrilleGraphPaper(Graphics g, int separation, int thickness)
      • private void drawDortmundGraphPaper(Graphics g, int separation, int dotsize)
    4. Here is what I mean by Dortmund Graph Paper:  
      • When I was on a conference trip to the Kongresszentrum Westfalenhallen (a conference hotel in Dortmund, Germany), the conference center gave out free pads of notepaper.   I was delighted to see that the paper was not horizontal rule that we are accustomed to (e.g., in legal pads, typical school notbooks, journal books, etc.), but more two-dimensional, like the quadrille-ruled notebooks I use for my research journals.   But the "Dortmund paper" represents a compromise:  instead of the heavy 2-D lines that many people seem to find distracting (but which I like), the paper has a very light touch when it comes to "rulings".   The paper has a grid of light gray dots.   Please see the handout in class.
      • Your challenge is to draw a grid just like this, to cover the whole page.   There are a number of ways to do this (e.g., nested loops, or a single loop with an if-then statement in the body to "wrap around" like a typewriter does, or a single-loop with the "remainder operator" (a.k.a., the "modulus operator"), "%", etc.).  
      • It must use gray dots (circles), not black ones.
      • It does NOT have to have any of the heading material (e.g., hotel name, logo, blank horizontal lines, etc.) of footer text that is on the example sheet.
    5. STYLE:   The usual (main comment, descriptive variable names, describe var.s in comments, comment all logical groups of code such as methods, loops, if-then's).
    6. TURN IN BY EMAIL:   Send me your java code.  Use SUBJECT LINE:  "CS120:  A7  ..."
  • GRADING:  TOTAL: 100 pts.
  • EXTRA CREDIT CHALLENGES:
    1. Annotations along the left and the top margins, with numbers indicating pixels.
    2. Logarithmic graph paper.
    3. Hexagonal graph paper!