Java Reference
In-Depth Information
(a)
(b)
(c)
F IGURE 14.51
(a) The polygon and a point are displayed. (b) Exercise14.25 connects five random points on a circle.
(c) Exercise 14.26 displays two clocks.
*14.25 ( Random points on a circle ) Modify Programming Exercise 4.6 to create five
random points on a circle, form a polygon by connecting the points clockwise,
and display the circle and the polygon, as shown in Figure 14.51b.
Section 14.12
14.26
( Use the ClockPane class ) Write a program that displays two clocks. The hour,
minute, and second values are 4 , 20 , 45 for the first clock and 22 , 46 , 15 for the
second clock, as shown in Figure 14.51c.
*14.27
( Draw a detailed clock ) Modify the ClockPane class in Section 14.12 to draw
the clock with more details on the hours and minutes, as shown in Figure 14.52a.
(a)
(b)
(c)
F IGURE 14.52
(a) Exercise 14.27 displays a detailed clock. (b) Exercise 14.28 displays a
clock with random hour and minute values. (c) Exercise 14.29 displays a bean machine.
*14.28
( Random time ) Modify the ClockPane class with three new Boolean properties—
hourHandVisible , minuteHandVisible , and secondHandVisible —and
their associated accessor and mutator methods. You can use the set methods to
make a hand visible or invisible. Write a test program that displays only the hour
and minute hands. The hour and minute values are randomly generated. The hour
is between 0 and 11 , and the minute is either 0 or 30 , as shown in Figure 14.52b.
**14.29
( Game: bean machine ) Write a program that displays a bean machine introduced
in Programming Exercise 7.21, as shown in Figure 14.52c.
 
 
Search WWH ::




Custom Search