Java - Loops, Methods and Classes Homework refactoring