Bill Manaris : Fall 2005 / CSCI 221 Homework 2

Assigned Date: Monday, Oct. 3, 2005 (sec 2 +1 day)
Due Date: Thursday, Oct. 13, 2005 (sec 2 +1 day)
Due Time: Noon

Last modified on October 06, 2005, at 04:58 PM (see updates)


This assignment focuses on Java inheritance, polymorphism, abstract classes, and interfaces.


Expand the Shape class hierarchy to include a class for equilateral triangles and a class for isosceles triangles (i.e.,, and For a review of such triangles, see triangle formulas. Rename the Triangle class to Scalene (i.e., and make it model scalene triangles triangles with three, possibly unequal sides.

Modify the Shape class and its subclasses to implement the Relation interface. The Relation interface methods should compare the areas of individual shapes. (Note: There are several ways to do this. Look for the most elegant one.)

Write a test program ( that creates a series of shapes and sorts the shapes into ascending order of size using the SortObj.sort() method.

Your code should be fully documented via javadoc. Test method preconditions, and throw IllegalArgumentException when needed.

Include the following in each class:

       Certification of Authenticity:

       I certify that this submission is entirely my own work, 
       as per course collaboration policy.

       Name: ________________________ Date: ___________


  1. Open your BlueJ project.
  2. Ensure it contains the following:,,,,,,,,,, and
  3. Open (edit) each source file and generate the class interface (javadoc). This can be done within the editor window either by pressing CTRL/J , or selecting the Interface drop-down menu item (on the right). (Note: This is necessary to generate your documentation for grading.)
  4. Under the Project menu, click Create Jar File... . In the dialog box that opens, select Include Source, and press Continue.
  5. Email the generated .jar file to, by the due date and time.
(Printable View of