CMIS 102A
1.
Make an applet that inputs the width and height of a rectangle and
then displays a rectangle of that size in the applet area. Also
display the perimeter and area of the rectangle, first in a
JOptionPane, and then in the applet area.
Hints: do all JOptionPanes in init. width and height need to
be fields.
2.
Make an applet that draws a triangle. The user inputs the x,y
coordinates of the three points (vertices) of the triangle.
Hint: three drawLines are needed.
OK. Now label the points (i.e. next to each point draw its coordinate
pair in the standard (x,y) format).
3. Bonus exercise!
Add to the Pythagoras applet so that it draws the right triangle.
In the paint method draw one vertical line for one of the sides,
a horizontal line for the other side, and the hypotenuse.
Figure out what the end points of the lines should be.
The drawing methods can not have double parameters, so change the
a and b variables to ints (further justifiable because applet drawing
lengths can only be integers anyway) (hypotenuse needs to be double
because it gets the sqrt value).