This website is preserved for historical and scholarly reference and is no longer actively maintained.
CpSc 210, Section 1
Assignment 8
November 13, 2002
Due: Tuesday, November 19, at 11:59 p.m.
Assignment: Extend Bailey's BinaryTree class to include a recursive equals
method.
Total point value of assignment: 50 points
Not accepted late.
This assignment is to be done INDIVIDUALLY.
Assignment: Design and implement a class, BTextended as an extension of
Bailey's BinaryTree, which must be stored in a file named
BTextended.java. (10 point deduction for failure to name file
correctly!)
Bailey's BinaryTree code may be found at the "View the Local Source"
link from
http://www.mhhe.com/javastructures
The BinaryTree interface is given on pages 190-191 of Java Structures.
Bailey's code does not include an equals method, so you are to supply it.
You may include any private methods you want.
You will want to import structure.BinaryTree.
The signature of the equals method is
public boolean equals ( Object other );
// post: returns true if and only if this is the same as other.
You will want to check that other is an instance of BTextended and then
cast it to another variable of type BTextended. (as in Assignment #4)
Grading Rubric:
5 pts. reasonable attempt to solve problem as assigned
(Method must be recursive.)
5 pts. also compiles
5 pts. style standards (includes clarity)
Now that we are dealing with references, the comment after
exit from "while" loops is especially important. The comment
on an "else" is also useful. One point will be deducted
for each missing comment (maximum of 5) in the code
that you write. (Yes, we know Bailey does not have these
and you cannot correct his code, but you can write yours
in this manner.)
Don't forget your pre- and post-conditions.
Do throw an IllegalArgumentException if precondition not met.
The following 35 points are available only for code that compiles
without error. Some considerations are:
20 pts. code of equals method returns correct answer
5 pts. evidence that your test driver (main method) systematically
checks for errors.
The following 10 points are available only for code that
returns correct answer:
5 pts. growth rate of equals method is best possible
5 pts. elegance of code
Other requirements:
The first operation of your main program must be to print "CPSC 210", your name, the assignment number, and a brief description of the assignment.
Follow the style standards to be found on your instructor's
web page for CPSC 210.
Submit your program using the handin command. There is a link to
the handin description on the CPSC 210 lab page (www.cs.clemson.edu/~lab210).