HOMEWORK ASSIGNMENT #1
Assigned Date: Wednesday, January 19, 2005 (sec 2 +1 day)
Due Date: Wednesday, February 2, 2005 (sec 2 +1 day)
Due Time: Noon
Updated: Wednesday, January 26, 2005, 1:30 p.m.
This assignment focuses on Java inheritance, polymorphism, abstract classes, and interfaces. It also gives you an opportunity to get comfortable with BlueJ.
All programs that you complete in your career as a student and as a professional developer should be fully documented. Follow the Golden Rule of Style: “A program should be as easy for a human being to read and understand as it is for a computer to execute.” 
Your comments should be in the Javadoc style.
You should always include opening comments that state the author of the file, the date, documentation of resources used to write the code, and comments related to the code and its functionality. This semester your opening comment section for every source file you submit should have the following format.
* Author: <Your Name>
* Email: <Your email address>
* Class: CSCI 221, Section <Your section number>
* Assignment: HMWK1
* Due Date: <The assignment's due date>
* Certification of Authenticity <include one of the following>:
* I certify that this work is entirely my own.
* I certify that this work is my own, but I received
* some assistance from: <Name(s), References, etc.>
* Purpose: <Provide a simple, yet complete description of the task being
* performed by this class. It may be several sentences long.>
Assignment: (adapted from )
Expand the Shape class hierarchy to include a class for equilateral triangles and a class for isosceles triangles (i.e., Equilateral.java, and Isosceles.java). For a review of such triangles, see triangle formulas. Modify the Triangle class (i.e., Triangle.java) to 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. There are several ways to do this. Look for the most elegant one.
Write a test program (TestShape.java) that creates a series of shapes and sorts the shapes into ascending order of size using the SortObj.sort() method.
Capture a screenshot of the BlueJ window displaying your class hierarchy (positioned just right!). For instance, on MS Windows, press <Alt>-<PrintScreen>, open MSWord or Wordpad, and paste the screenshot by pressing <Ctrl>-V. Add your name, date, course, etc. info. Save the document as ClassDiagram.doc .
You should submit your source file on a floppy disk, as per syllabus instructions.
Source filenames to be submitted:
A zip archive named <firstName_lastName_fourLastDigitsofSSN>.hmwk1.zip (for example, Bill_Manaris_2308.hmwk1.zip). This archive should contain the following files:
· Shape (the BlueJ project directory). Within Shape there should be the following files:
o Readme.txt (see Widget for a sample)
o Any files generated automatically by BlueJ (e.g., bluej.pkg, bluej.pkh, etc.)
o Shape.java, Circle.java, Pentagon.java, Rectangle.java, Square.java, Triangle.java, Equilateral.java, Isosceles.java, Relation.java, SortObj.java, and TestShape.java)
o doc subdirectory with .html API files, one for each of your classes (e.g., Shape.html, etc.). These files contain the javadoc documentation generated from your source files when you press <Ctrl>-J within the BlueJ source-code editor window.