CSE 341 -- Programming LanguagesWinter 2000 |
Department of Computer Science and Engineering, University of WashingtonSteve Tanimoto (instructor) and Jeremy Baer (teaching assistant). |
Assignment J1Version 1.01 of January 26. Subject to change. |
Java WarmupDue date and time: Monday, January 31, 2000 at 10:30 (Submit your assignment electronically by filling out an online submission form.). |
Instructions: Examine the Sample Java Applet containing a pair of buttons. Then write a Java applet that includes a class called GeometricObject and two subclasses called Square and Circle. The applet should contain two buttons. The user will click on "Squares" to start drawing squares and "Circles" to start drawing circles. After clicking one of these buttons, the user will draw a circle or square by simply clicking within a drawing area on the screen. Use an instance of the built-in type Canvas to implement the drawing area. Optional functionality: (1) the ability to control the sizes of the squares and circles, (2) the ability to control the fill color of the squares and circles, (3) using a third button to clear the canvas, (4) adding other geometric shapes, (5) permitting the user to delete a square or circle by clicking on another button ("Delete") and then clicking on the square or circle, (6) allowing the user to put text on the canvas.
Here is an executable for a sample solution.
Programming style: Comment your function definitions clearly.
using the style given in the sample program.