19.09.2015 Views

Prentice.Hall.Introduction.to.Java.Programming,.Brief.Version.9th.(2014).[sharethefiles.com]

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

equest that the eleva<strong>to</strong>r <strong>com</strong>e <strong>to</strong> his or her floor. On entering the eleva<strong>to</strong>r, the<br />

passenger clicks a but<strong>to</strong>n on the right <strong>to</strong> request that it go <strong>to</strong> the specified floor.<br />

<strong>Programming</strong> Exercises 701<br />

FIGURE 18.21<br />

The program simulates eleva<strong>to</strong>r operations.<br />

*18.14 (Control a group of clocks) Write a <strong>Java</strong> applet that displays three clocks in a<br />

group, with control but<strong>to</strong>ns <strong>to</strong> start and s<strong>to</strong>p all of them, as shown in Figure 18.22.<br />

VideoNote<br />

Control a group of clocks<br />

FIGURE 18.22<br />

Three clocks run independently with individual control and group control.<br />

Sections 18.10–18.12<br />

*18.15 (Enlarge and shrink an image) Write an applet that will display a sequence of<br />

images from a single image file in different sizes. Initially, the viewing area for<br />

this image has a width of 300 and a height of 300. Your program should continuously<br />

shrink the viewing area by 1 in width and 1 in height until it reaches<br />

a width of 50 and a height of 50. At that point, the viewing area should continuously<br />

enlarge by 1 in width and 1 in height until it reaches a width of 300 and<br />

a height of 300. The viewing area should shrink and enlarge (alternately) <strong>to</strong><br />

create animation for the single image.<br />

***18.16 (Simulate a s<strong>to</strong>ck ticker) Write a <strong>Java</strong> applet that displays a s<strong>to</strong>ck-index ticker<br />

(see Figure 18.23). The s<strong>to</strong>ck-index information is passed from the <br />

tag in the HTML file. Each index has four parameters: Index Name (e.g., S&P<br />

FIGURE 18.23<br />

The program displays a s<strong>to</strong>ck-index ticker.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!