mmasif 0 Newbie Poster

here is my code and i am receiving errors for my test class.

//***************************************************
// 
// Project 6
// Assigned:  4/27/10
// Due On:  5/4/10
//
// This Project Creates a Binary Tree Using the Class
// BinarySearchTree, and Inserts an Array of Integers
// Into the Tree, and Then Traverses the Tree
//***************************************************

import java.io.*;
import java.util.*;

public class BinaryProject
{

        public static void main(String[] args)
        {

                //Creates an Array of Integers to
                //Insert into Tree
                int[] treeNumbers = {41,31,21,41,
                                                                        36,16,46,26,
                                                                        56,16,33,38,
                                                                        101,48,56,44,
                                                                        45,43,33};

                //Create a Binary Search Tree Object of
                //Type Integer, intTree                                                 
                BinarySearchTree<Integer> intTree = new BinarySearchTree();

                        System.out.println();
                        System.out.println(treeNumbers.length+" Integers Inputed....");
                          System.out.println();
                        fillTree(intTree, treeNumbers);
                          System.out.println();
                        printResults(intTree);

                        }

        //Method to Fill Tree With Array
        public static void fillTree(BinarySearchTree<Integer> intTree, int[] treeNumbers)
        {
                int num;

                for (int i=0; i<treeNumbers.length; i++)
                        intTree.insert(treeNumbers[i]);
        }

        //Method to Count Tree Nodes
        public static int countNodes(BinarySearchTree<Integer> intTree)
        {
                return intTree.treeNodeCount();
        }

        //Method to Count Tree Leaves
        public static int countLeaves(BinarySearchTree<Integer> intTree)
        {
                return intTree.treeLeavesCount();
        }

        //Method to Return Tree Height
        public static int getHeight(BinarySearchTree<Integer> intTree)
        {
                return intTree.treeHeight();
        }

        //Method to Return Tree Width of
        //A Balanced Tree
        public static int getWidth(BinarySearchTree<Integer> intTree)
        {
                return intTree.treeWidth();
        }

        //Method to Count Nodes With One Child
        public static int singleChild(BinarySearchTree<Integer> intTree)
        {
                return intTree.singleChildNodes();
        }

        //Method to Print Results After Traversing Tree
        public static void printResults(BinarySearchTree<Integer> intTree)
        {
                        System.out.println("Nodes: "+countNodes(intTree));
                          System.out.println();
                        System.out.println("Height: "+getHeight(intTree));
                          System.out.println();
                        System.out.println("Leaves: "+countLeaves(intTree));
                          System.out.println();
                        System.out.println("Width: "+getWidth(intTree));
                          System.out.println();
                        System.out.println("Nodes With 1 Child: "+singleChild(intTree));
                          System.out.println();

                        System.out.println("In Order Traversal");
                          intTree.inorderTraversal();
                            System.out.println();
                        System.out.println("Preorder Traversal");
                          intTree.preorderTraversal();
                            System.out.println();
                        System.out.println("Post Order Traversal");
                          intTree.postorderTraversal();
                            System.out.println();
        }       


}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.