| Scott Grissom School of Computing & Info Systems Grand Valley State University |
|
|||
CS 162 Computer Science I | |||
| Syllabus | Schedule & Assignments | Help | Gradebook |
PreparationDo the following before arriving at lab:
ObjectivesAfter completing this lab, you should be able to:
ExercisesGetting Started
Graphic BasicsNote that the "paint" method has a parameter of type Graphics. The Java Graphics class has a number of methods to draw things. You only need to understand two of the methods for this assignment.
For practice, draw a few different colored rectangles of differnent sizes and different locations..
BullseyeAdd code to the paint method to draw a bullseye. Concentric circles using two colors. Show your solution to the instructor. Checkerboard - Start with one row
Now draw a full Checker BoardNow place the above code in a loop that iterates eight times to draw eight rows. You will need to add clever logic to alternate between black and red appropriately. Getting More SophisticatedImprove your solution so that you call "fillRect" only once. Already Done?Now place three round green checkers and five round blue checkers one the board in any positions you choose. You will want to use the g.fillOval( ) method that uses the same parameters as the fillRect( ) method. Sample Results
Grading CriteriaThis lab is worth a possible 10 points. Turn in a printout of the source code for Checkerboard.
|