CS 120   Winter 2016,  Instructor:  Jeffrey Horn
 

 Assignment 4:   "Graphics"


  • Handed out:  Thurssday, Feb. 18, 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)
  • Example Code:   (in class)
  • 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 ONLY your Panel class byte code file, to "jhorn@nmu.edu" with SUBJECT line:  "CS120  A5 class file".
    6. (Later I MIGHT ask you to submit your .java souce code file as well!)
  • 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...)