@@ -0,0 +1,1838 @@
+package assignment2;%0A%0Aimport assignment2.bintree.base.BinTree;%0A%0Apublic class Client %7B%0A%0A%09public static void main(String%5B%5D args) %7B%0A%09%09Client c = new Client();%0A%09%09%0A%09%09// Test BinTree (Binary Tree)%0A%09%09if (c.testBinaryTree()) %7B%0A%09%09%09System.out.println(%22BinTree Passed.%22);%0A%09%09%7D%0A%09%7D%0A%09%0A%09private boolean testBinaryTree() %7B%0A%09%09BinTree%5B%5D bt = new BinTree%5B5%5D;%0A%09%09%0A%09%09for (int i = 0; i %3C 5; ++i) %7B%0A%09%09%09// Create 5 new instances, identified from 0..4%0A%09%09%09bt%5Bi%5D = new BinTree(i);%0A%09%09%09%0A%09%09%09// Contract 1: Ensure that the newly created instance does not have a height of zero.%0A%09%09%09assert(bt%5Bi%5D.height() != 0);%0A%09%09%09%0A%09%09%09// Contract 3: Ensure newly created instance does not have a left or right node.%0A%09%09%09assert(! bt%5Bi%5D.hasLeft());%0A%09%09%09assert(! bt%5Bi%5D.hasRight());%0A%09%09%7D%0A%09%09%0A%09%09// Contract 4: setLeft rejects null parameter.%0A%09%09//bt%5B0%5D.setLeft(null); // Should error out.%0A%09%09bt%5B0%5D.setLeft(bt%5B1%5D);%0A%09%09%0A%09%09// Contract 6: left is no longer null%0A%09%09assert(bt%5B0%5D.getLeft() != null);%0A%09%09%0A%09%09// Contract 7: left is the node we expect.%0A%09%09assert(bt%5B0%5D.getLeft() == bt%5B1%5D);%0A%09%09%0A%09%09// Constract 8: setRight rejects null parameter.%0A%09%09//bt%5B0%5D.setRight(null); // Should error out.%0A%09%09bt%5B0%5D.setRight(bt%5B2%5D);%0A%09%09%0A%09%09// Contract 10: right is no longer null%0A%09%09assert(bt%5B0%5D.getRight() != null);%0A%09%09%0A%09%09// Contract 11: right is the node we expect%0A%09%09assert(bt%5B0%5D.getRight() == bt%5B2%5D);%0A%09%09%0A%09%09// Contract 5: setLeft will not overwrite existing node.%0A%09%09bt%5B0%5D.setLeft(bt%5B3%5D);%0A%09%09assert(bt%5B0%5D.getLeft() != bt%5B3%5D);%0A%09%09assert(bt%5B0%5D.getLeft() == bt%5B1%5D);%0A%09%09%0A%09%09// Contract 9: setRight will not overwrite existing node.%0A%09%09bt%5B0%5D.setRight(bt%5B4%5D);%0A%09%09assert(bt%5B0%5D.getRight() != bt%5B4%5D);%0A%09%09assert(bt%5B0%5D.getRight() == bt%5B2%5D);%0A%09%09%0A%09%09return true;%0A%09%7D%0A%09%0A%09private boolean testBalancedBinaryTree() %7B%0A%09%09return true;%0A%09%7D%0A%09%0A%09private boolean testFullBinaryTree() %7B%0A%09%09return true;%0A%09%7D%0A%09%0A%09private boolean testPerfectBinaryTree() %7B%0A%09%09return true;%0A%09%7D%0A%0A%7D%0A

Create test client class.