# Week 5 Exercises

1. Hand in a screen shot that shows an applet running inside the applet viewer.

2. Hand in a screen shot that shows an applet running inside a web browser displaying a message in the Java console.

3. Write an applet that randomly places a designer specified number of rectangles of random sizes and colors at least partially inside the applet's visible area. Be sure to intelligently handle the case where the designer does not provide proper initialization parameters for the applet.

Make the applet available on a Web page. The Web page should thoroughly test the capabilities of the applet. Include a link to full source code for the applet. Hand in the source code for the applet, sample HTML files for the applet, screenshots of the running applet, and a URL where the applet can be viewed.

4. Write an applet that draws a graph of p(n) vs. n where p(n) is the nth iteration of the logistic equation (p(i) = r*p(i-1)*(1.0-p(i-1)). (You only need to draw the graph. You do not need to draw axes or legends or anything of that nature.) Use `PARAM` tags to specify the rate, the initial population, the x and y scale factors and the number of iterations to track. Note that it is not necessary to achieve convergence. Thus this problem is a little different from previous ones involving the logistic equation.

Make the applet available on a Web page. Include at least three instances of the applet on the page: one with a rate between 1 and 2, one with a rate between 2 and 3, and one with a rate between 3 and 4. Include a link to full source code for the applet. Hand in the source code for the applet, sample HTML files for the applet, screenshots of the running applet, and a URL where the applet can be viewed.

5. Write an applet that reads an indefinite number of strings from `PARAM` tags and draws them.

6. Allow the Web page designer to specify the font face, size, and style of each string in the applet from problem 2. Be sure to handle the case of the font not being available on the client.

7. Also let the designer pick the color of each string.

8. Finally, let the Web page designer specify the position of each string. Thus you should hand in an applet that allows the designer to specify the font, size, style, color, and position of an indefinite number of strings.

9. Make the applet available on a Web page. The Web page should thoroughly test the capabilities of the applet. Include a link to full source code for the applet. Hand in the source code for the applet, sample HTML files for the applet, screenshots of the running applet, and a URL where the applet can be viewed.

Copyright 1997-1999, 2005 Elliotte Rusty Harold
elharo@metalab.unc.edu