X923: Writing Methods With Parameters

For this question, we will be working with a subclass of Jeroo called CountingJeroo that tracks the number of hops it has peformed. This jeroo has the following method. You can get the number of hops performed so far by calling the getHopCount() method.

public void hopAndPickMany(int hopsAndPicks)
{
    int counter = 0;
    while (counter < hopsAndPicks)
    {
        this.hop();
        this.pick();
        counter = counter + 1;
    }
}

Call this method so the jeroo leon hops and picks 5 flowers.

Your Answer:

Feedback

Your feedback will appear here when you check your answer.