Assignment 2 (due 7 March)

(last updated:  3 March 2001)
 


In this assigment you will write an object oriented program using Java that will consist of a class hierarchy of shapes (e.g., square, triangle, circle) that implement a shape interface.  The shape interface requires that a shape provides instance methods to reveal its name, and its perimeter and area measurements.

To be handed in:  a diskette labeled with your name, containing the subdirectories comprising your JBuilder project subtree (your .jpr project file should be in the root of the subtree) and printouts of your Java source files (*.java).  Please place your diskette and printouts in a large envelope also labeled with your name.

The project will consist of the following interface and classes:










 
(!) Note: All constructors and all instance methods should be public, and all attributes should be protected.
 

The GUI (Graphical User Interface) should look something like this:



The output from the System.out.println()'s should look something like this:

Shape Rectangle with area = 20.0 and perimeter = 18.0
Shape Square with area = 36.0 and perimeter = 24.0
Shape Triangle with area = 6.0 and perimeter = 12.0
Shape Circle with area = 113.09733552923255 and perimeter = 37.69911184307752