Java Reference
In-Depth Information
PP 8.13 Design a class that represents the visual representation of a car.
Use polylines and polygons to draw the car in any graphics con-
text and at any location. Create a main driver to display the car.
PP 8.14 Modify the solution to PP 8.13 so that it uses the Polygon class
to represent all polygons used in the drawing.
PP 8.15 Modify the QuoteOptions program from Chapter 5 so that it
provides three additional quote options. Use an array to store all
of the quote strings.
PP 8.16 Design and implement a program that draws 20 circles, with the
radius and location of each circle determined at random. If a
circle does not overlap any other circle, draw that circle in black.
If a circle overlaps one or more other circles, draw it in cyan.
Use an array to store a representation of each circle, then deter-
mine the color of each circle. Two circles overlap if the distance
between their center points is less than the sum of their radii.
PP 8.17 Design and implement a program that draws a checkerboard
with five red and eight black checkers on it in various locations.
Store the checkerboard as a two-dimensional array.
PP 8.18 Modify the program from PP 8.17 so that the program deter-
mines whether any black checkers can jump any red checkers.
Under the checkerboard, print (using drawString ) the row and
column position of all black checkers that have possible jumps.
PP 8.19 Modify the RubberLines program from this chapter so that it
shows all of the lines drawn. Show only the final lines (from
initial mouse press to mouse release), not the intermediate lines
drawn to show the rubberbanding effect. Hint : Keep track of
a list of objects that represent the lines similar to how the Dots
program kept track of multiple dots.
PP 8.20 Design and implement a program that counts the number of
times the mouse has been clicked. Display that number in the
center of the applet window.
PP 8.21 Design and implement an application that creates a polyline
shape dynamically using mouse clicks. Each mouse click adds
a new line segment from the previous point. Include a button
below the drawing area to clear the current polyline and begin
another.
PP 8.22 Design and implement an application that draws a circle using
a rubberbanding technique. The circle size is determined by a
mouse drag. Use the original mouse click location as a fixed
Search WWH ::




Custom Search