Homework 6 for Computer Science 125

Introduction to Computer Science

Boise State University, Spring 1999


This homework is due by 9 p.m., Friday, 2 April 1999. See the directions in Homework 1 to electronically submit homework.

Warm-up and Practice Problems

These are not be turned in. They are to help you understand the material, and some will appear on exams.

Graded Problems

You must comment your code (see book for examples).
You must include comments for all functions, following the javadoc format. See CCJ, p 183-185 for more details.

P16. (Person class) Implement a class Person that contains the first name, last name, and birthday of a person. Use the two files provided below: Submit this as program 16 using the electronic submission. Include the classes Program16 and Person in separate files.

P17. (Triangles) Exercise P8.9, p 365. Submit this as program 17 using the electronic submission. Include the classes Program17 and Triangle as separate files. Include an HTML file in the directory called Program17.html that displays your applet.

Note: Your Program17 class should contain a sample program that demonstrates the features of the Triangle class. It should not ask for input, but it should draw several triangles, move them, and redraw them.

P18. (Three Color Draw) Modify the OneColorDraw applet to allow the user to change colors that are drawn. Add at least 3 choices of colors and buttons for each choice. For example, if you choose the colors red, blue, and black, you should have buttons that when pressed, change the color that is drawn to red, blue, or black, respectively. Your applet should also have a clear button like OneColorDraw. For example:

Submit this as program 18 using the electronic submission. Please call the file (and the class) Program18. Include an HTML file in the directory called Program18.html that displays your applet.