Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

JAVA introductory class Play Hoppity Hop: Students count out loud 1, 2, 3, .. to

ID: 670823 • Letter: J

Question

JAVA introductory class

Play Hoppity Hop:

Students count out loud 1, 2, 3, .. to establish an order in the class (first student 1, second student 2, etc. )

Repeat, but this time nobody can mention a multiple of 3. Instead s/he has to say Hoppity

Repeat, but this time in addition to Hoppity nobody can say a multiple of 5. Instead s/he has to say Hop

Repeat everyone has a clear understanding of the rules of this game

Description:

Displays the numbers from 1 to 25, each in one line. However, every multiple of 3 is replaced by the word Hoppity and every multiple of 5 is replaced by Hop

Build groups of up to 4 students.
Before starting with the implementation groups gather around the white boards to think through the problem and to write a pseudo code.
Students can also walk around the room and to check out approaches of other teams.

As soon as a team has completed its pseudo code and the team members agree that they found a feasible solutions they can start implement their algorithm.

Output:

1

2

Hoppity

4

Hop

Hoppity

7

8

Hoppity

Hop

11

Hoppity

13

14

Hoppity

Hop

16

17

Hoppity

19

Hop

Hoppity

22

23

Hoppity

Hop

Explanation / Answer

import java.io.BufferedReader; import java.io.PrintWriter; import com.google.code.facebook.puzzle.common.BaseCommandLineClient; /** * @author nmukhtar * */ public class HoppityHop extends BaseCommandLineClient { /** */ @Override public void process(BufferedReader input, PrintWriter output) throws Exception { long number = Long.parseLong(input.readLine()); for (int i = 1; i