CS 120
Winter 2016, Instructor: Jeffrey
Horn
Assignment
4: "Graphics"
Handed out:
Thurssday, Feb. 18, 2016
Due: TBA
Purpose: Learn
- basics of Java graphics: Graphics
class, paint method, drawing commands
- creating and using randomness
- 24-bit color coordinate system
- for-next loops
- intro to event-driven programs (calling
paint)
Example Code: (in class)
DETAILS:
-
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.
-
Give a 3D effect using lines to indicate a highway, river, etc. converging
toward the horizon.
-
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)
-
Use a for-next loop (e.g., for the hundreds of random objects)
Send me ONLY your Panel class byte code file, to "jhorn@nmu.edu"
with SUBJECT line: "CS120 A5 class file".
(Later I MIGHT
ask you to submit your .java souce code file as well!)
GRADING: TOTAL: 100 pts.
EXTRA CREDIT CHALLENGES:
- Use randomized colors in your randomized objects.
- Make your graduated
sky curved (e.g., successive ovals). Especially impressive if you can
do this without leaving "holes"! (i.e., uncolored pixels...)