CSC 103 Lab Quiz
On latte, go to the directory ~gfisher/classes/103/labs/quiz. There you will find a file named ViewableBinaryTree.java. This is a version of BinaryTree with methods that implement the JFC TreeModel interface. There are three additional files in the quiz directory named BinaryTreeNode.java, ViewableBinaryTreeTest1.java, and ViewableBinaryTreeTest2.java. The BinaryTreeNode class is the same one we've been working with in lab. The ViewableBinaryTreeTest1, and 2 classes are testing programs.
To work on the quiz, set things up as follows:
cd ~/csc103 mkdir quiz cd quiz cp ~gfisher/classes/103/labs/quiz/*.java .
Your job for the quiz is to implement the five methods of ViewableBinaryTree that contain the comment "FILL IN HERE:". Implement these methods as they are described in the method comments. Here are some important points about the implementation:
Test that your program works correctly in two phases. First compile and
execute as follows:
Inspect the output results of this test carefully to see that they are correct. Output lines are of the form:javac ViewableBinaryTreeTest1.java java ViewableBinaryTreeTest1
Test case N, output should be X:
Once your program runs correctly with ViewableBinaryTreeTest1, compile
and execute with test 2 as follows:
javac ViewableBinaryTreeTest2.java java ViewableBinaryTreeTest2
Full tree
Left-heavy tree
Right-heavy tree
Zig-zag tree
In textbook form the trees look like this:
When you have your program working, raise your hand and I'll come around to check it. If you don't get it working by the end of lab, turn in what you have using the turnin program. Turn it in under the assignment name "quiz". Turn in the file ViewableBinaryTree.java.