Question: Write a new class, PokemonMain, with a main method that: a . Creates a binary tree with your favorite Pok mon at the root and

Write a new class, PokemonMain, with a main method that:
a. Creates a binary tree with your favorite Pokmon at the root and a new PokemonComparator.
b. Insert at least 10-15 more Pokmon in any order.
c. Use your StringVisitor to stringify the binary tree and print the string. They should print in reverse order by number (from largest to smallest).
The Comparable interface is implemented by a class that needs to define its own natural order. It is called on one instance of the class to compare itself to another instance of the same class, e.g. A. compareTo(B). It works the same way that Comparable does:
a. It returns an integer 0 if A comes before B in order, i.e. ABA==B>BB'AA
b.It returns 0if A and B are equivalent, i.e.A==B
c.It returns an integer >0if A comes after Bin order, i.e.A>B
Update your Pokmon class to implement Comparable so that the Pokmon are arranged in order by number (from smallest to largest). For example, if Pokemon A's number if25 and B's number is50,A. compareTo(B) would return a number 0 because A should come first.
Write a new class, PokemonMain, with a main

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!