CS 120   Fall 2016,  Instructor:  Jeffrey Horn
 

 Assignment 3:   "Graphics"


  • Handed out:  Tuesday, September 6, 2016
  • Due:    TBA
  • Purpose:  Learn
    1. basics of Java graphics:  Graphics class, paint method, drawing commands
    2. creating and using randomness
    3. 24-bit color coordinate system
    4. for-next loops
    5. intro to event-driven programs (calling paint)
  • Background Material:
  • Graphics comands from textbook (GUI Java):  here
  • Example Code:  
  • Basic starting files:   Two files needed (A3.java, PanelApplication.java), or in one zipped folder here.
  • Additional examples (in class, and also online notes here)
  • DETAILS:
    1. Paint a landscape at sunset or sunrise (or thereabouts!).   This means a sky with a continuous gradation in brightness (from dark to light or vice versa, vertically), above, with a surface (e.g, land, water) below.
    2. Give a 3D effect using lines to indicate a highway, river, etc. converging toward the horizon.
    3. Fill the sky, or the ground, with hundreds of randomly located objects (e.g., stars, snow flakes, raindrops, flowers, etc.).   They can be the same color, and the same size, but they should be sprinkled about!   (i.e., different locations)
    4. Use a for-next loop (e.g., for the hundreds of random objects)
    5. Send me .java source code file, to "jhorn@nmu.edu" with SUBJECT line:  "CS120  A3".
  • GRADING:  TOTAL: 100 pts.
  • EXTRA CREDIT CHALLENGES:
    1. Use randomized colors in your randomized objects.
    2. Make your graduated sky curved (e.g., successive ovals).  Especially impressive if you can do this without leaving "holes"!  (i.e., uncolored pixels...)