chap binary trees public interface varbinnode public boolean isleaf()class varleafnode implements varbinnode /leaf node private string operand/operand value public varleafnode(string valoperand valpublic boolean isleaf(return truepublic string value(return operand}/*internal node *class varintlnode implements varbinnode private varbinnode left/left child private varbinnode right/right child private character operator/operator value public varintlnode(character opvarbinnode lvarbinnode roperator opleft lright rpublic boolean isleaf(return falsepublic varbinnode leftchild(return leftpublic varbinnode rightchild(return rightpublic character value(return operator/*preorder traversal *public static void traverse(varbinnode rtif (rt =nullreturn/nothing to visit if (rt isleaf()/process leaf node visit visitleafnode(((varleafnode)rtvalue())else /process internal node visit visitinternalnode(((varintlnode)rtvalue())traverse(((varintlnode)rtleftchild())traverse(((varintlnode)rtrightchild())figure an implementation for separate internal and leaf node representations using java class inheritance and virtual functions