Assignment 4

CSC 115 -- Fall 2002

Objectives

Instructions 

Part I of the assignment is to be done with a fellow classmate.  Pair up with a partner during the lab or use the webboard.  Part II should be done alone.

Part I

The goal of this part of the assignment is to gain experience using many of the Java 2 built in classes and interfaces.  During the past week or two in class, we have learned how to write our own Tree class and tree iterators.  In this assignment you will learn how to use some of the built-in classes in Java for creating and manipulating trees. 

As a first step, you should familiarize yourself with JTrees from the Java sun tutorial:

JTtrees:  http://java.sun.com/docs/books/tutorial/uiswing/components/tree.html

You should explore and thoroughly understand the following examples from this tutorial (these examples will be described in detail in the lab, so do not miss your lab this week!):

You will also need to know how to use the following provided classes:

You and your partner  should explore these built in classes and interfaces together, taking turns to explain the code to each other.  You should understand all of this code thoroughly before attempting any implementation.  While you explore, take turns editing the example code to explore it more deeply.  (Note:  you will need to describe how you worked with your partner for Part II of the assignment.)

Implementation requirements

For this assignment, you will learn how to use a graphical representation of a tree using the tree built in classes and interfaces in Java.    Using the DynamicTree and DynamicTreeDemo example classes mentioned above as a starting point, your graphical tree view will have controls which will allow  a user to add and remove nodes from the tree, as well as a button to empty the tree.  The user can also expand and collapse branches in the tree. 

You need to add a text area to  the bottom of the tree window that will display  preorder, inorder and postorder traversals of the visible parts of the tree.   Therefore, when the user changes  the tree by adding a node, removing a node, renaming a node or clearing the tree, the traversals should be updated.  The DynamicTree example already has listeners for when a user adds, removes or clears the tree.   You need to add code to these listeners to create your traversal display.   You will also need to add a listener for when the user collapses or expands a branch in the tree.

You are free to design the output style of the tree traversals (bonus marks will be awarded for outstanding displays of the traversals).  The only requirement is that your output is clear and that it is intuitive for the user to read the traversals and that they map correctly to the visible tree. 

Hints

Part II

For Part II, you are to write a description of your experiences doing pair programming and design (one to two pages).    You should write this summary alone.  In your essay, you should discuss which aspects of pair programming you found useful, how it helped you learn (or how you helped your partner learn) and what you would do differently the next time you had to do pair programming.   Your short essay should be typed and spell checked.

Due dates

Remarks

The graders are instructed to take the following points into account when marking your assignment: