***Jim's Sample Solution***

Double Latte Please...

Due Date:  Thursday November 4, 1999 at start of class.

Assignment:
Write a Monogram class that draws your own personal monogram.

Background
-  SIZE of the Monogram:  The monogram must fit into a square that is no larger than 50 pixels by 50 pixels. This is very important.
-  BACKGROUND Color:  The user will choose one of three background colors for the monogram using buttons in the applet. Changing the background color will cause a new monogram to be drawn on the screen.
-  DRAWING the Monogram: The applet must contain a draw button that draws the monogram in the chosen color.  New monograms must be drawn in the "next" position.  The "next" position is one monogram to the right of the current one unless the monogram will no longer fit in the window.  If the next monogram no longer fits on the current line, it should be drawn on the next line at the left edge of the applet window.  NOTE that only one monogram will appear on the screen at a time.

To do this program you will need two .java files:
1. one for the Monogram class
2. one for the Applet class.

NOTE that the .html file does not refer to the Monogram class in any way - it must calls the applet class in the same manner that you have used in the previous labs.

The Monogram class will have all of the data and methods needed by the Applet to be able to set
the color of the background, report the size of the monogram, and to draw the monogram.

The Applet class will instantiate a Monogram object and send messages to the object to change its background color, change its x and y location, and to draw itself.

You can model your class off of the Frog class provided in section.

Handin Instructions:
If you are going to hand in to the intront server, turn in a folder with your two .java files.  That folder should be named as follows:
 LastName-FirstInitial-Lab10

If you are turning in to the course volume using ftp, turn in only the two files - do not turn in a folder/subdirectory.   The path will be announced in class and via e-mail - Martin is experimenting with some software and we may use it.


15-119 Fall 99                                                              Lab 11

Back to 15-119 Assignments