Question: Write a method called hopscotch that accepts an integer number of hops as its parameter and prints a pattern of numbers that resembles a hopscotch

Write a method called hopscotch that accepts an integer number of “hops” as its parameter and prints a pattern of numbers that resembles a hopscotch board. A “hop” is a three-number sequence where the output shows two numbers on a line, followed by one number on its own line. 0 hops is a board up to 1; one hop is a board up to 4; two hops is a board up to 7; and so on. For example, the call of hopscotch(3); should print the following output:

2 3 5. 6. 8 9. 10 4.

A call of hopscotch(0); should print only the number 1. If it is passed a negative value, the method should produce no output.

2 3 5. 6. 8 9. 10 4.

Step by Step Solution

3.52 Rating (179 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

public static ... View full answer

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 Building Java Programs A Back to Basics Approach Questions!