UNB/ CS/ David Bremner/ teaching/ old/ cs1083/ java/ StringTree.java
import java.util.Vector;
public class StringTree {
    private String root;
    Vector<StringTree> children;
    public StringTree(String rootString,
                      StringTree... kids){
        root=rootString;
        children=new Vector<StringTree>();
        for (int i=0; i<kids.length; i++){
            children.addElement(kids[i]);
        }
    }
    private void printAt(int indent){
        for (int i=0; i<indent; i++)
            System.out.print(" ");
        System.out.println(root);
        for (int i=0; i<children.size(); i++)
            children.elementAt(i).printAt(indent+8);
    }

    public void print(){
        printAt(0);
    }

    public static void main(String args[]){
        StringTree example=
            new StringTree("CS1073",
                new StringTree("ARTS1000", new StringTree("ARTS2000")),
                new StringTree("CS1083",
                    new StringTree("CS2043"),
                    new StringTree("CS2254"),
                    new StringTree("CS3613")));
        example.print();
    }


}