3 Hoppers hop in a crazy-fun-wild Hopper jump-fest!
Check out the Hopper class. Data and methods are into a single file.
Every Hopper object stores:
Every Hopper has regular accessor/mutator methods, and it screams when it hops! It also has a toString() method which returns a String of data currently stored in the object.
Let's get these guys and gals racing!
When a race is complete, the Selection Sort algorithm is used to determine the winner.
The Hopper array, hoppers is sorted by distance and the Hopper at index 2 is determined the winner.
In your IDE set up a new project called HopperProject.
Somehow import the Hopper class code and the Main class code into your project.
Answer the questions in the worksheet and complete the coding tasks.
Other algorithms you may be familiar with are:
Can we create Helper Functions in our Main class to search and sort the Hopper array in different ways?
This may be a review activity or an opportunity to explore other algorithms.
class
attributes
constructor method
accessor method
mutator method
create an instance of a class (ie an object)
instantiate an object
a reference variable (to an object)
parameter