DEV Community

Discussion on: Java Problem

Collapse
 
bertilmuth profile image
Bertil Muth • Edited

I don‘t know what you have tried so far. I don‘t want to solve it completely for you, since solving it is important for learning.

But in general, you need to break down a larger problem in smaller problems. Create a method for each subproblem.

For example:
A) You need a method that takes an arbitrary number as input, and jumps an even number (and returns it)
B) You need a method that takes an arbitrary number and jumps an even number n times. Since you have A), you can base your implementation on it.
C) You need some kind of increasing counter, that then uses B) to calculate the next number.

Good luck!