Fall2005.CSCI221Homework2 History

Hide minor edits - Show changes to output

Changed lines 19-20 from:
Your code should be fully documented via javadoc. Use exceptions to test method preconditions.
to:
Your code should be fully documented via javadoc. Test method preconditions, and throw @@[[http://java.sun.com/j2se/1.4.2/docs/guide/lang/assert.html | IllegalArgumentException]]@@ when needed.
Added lines 1-44:
'''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 {$LastModified} (see [[http://www.cs.cofc.edu/~manaris/index.php/Fall2005/CSCI221Homework2?action=diff&source=n&minor=n | updates]])

!!!Purpose

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

!!! Assignment

Expand the @@[[http://stono.cs.cofc.edu/~manaris/fall04/cs221/code/Shape.zip|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 [[http://mathforum.org/dr.math/faq/formulas/faq.triangle.html|triangle formulas]]. Rename the @@Triangle@@ class to @@Scalene@@ (i.e., @@Scalene.java@@) 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 (@@TestShape.java@@) 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. Use exceptions to test method preconditions.

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: ___________


!!! Submission

# Open your BlueJ project.

# Ensure it contains the following: @@Shape.java@@, @@Circle.java@@, @@Pentagon.java@@, @@Rectangle.java@@, @@Square.java@@, @@Scalene.java@@, @@Equilateral.java@@, @@Isosceles.java@@, @@Relation.java@@, @@SortObj.java@@, and @@TestShape.java@@.

# 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.)

# Under the Project menu, click ''Create Jar File...'' . In the dialog box that opens, select ''Include Source'', and press ''Continue''.

# Email the generated @@.jar@@ file to ''manaris@cs.cofc.edu'', by the due date and time.