Question: So, I have an BTree for all values and what have to be done is Add the enum trav with the values PREORDER, INORDER and
So, I have an BTree for all values and what have to be done is
Add the enum trav with the values PREORDER, INORDER and POSTORDER to the project. Then add a constructor parameterized with this enum to the BTree class and save the passed value in a traversal attribute. Finally, override the toString() method of the BTree class: Depending on the value of the traversal attribute, the toString() method should output the tree in the appropriate order.
Create the ChemElement class with the attributes name (String) and density(double), which implements the Comparable interface. Also, add an appropriate constructor, override the class's toString() method, and implement the compareTo() method to compare the density of the elements (lighter elements are smaller).
Can somebody explain me, how to do this in java?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
