Requirement – forward and backward moves

Now that we know where our ship is, let's try to move it. To begin with, we should be able to go both forwards and backwards.

Implement commands that move the ship forwards and backwards (f and b).

The Location helper class already has the forward and backward methods that implement this functionality:

public boolean forward() {

Get Test-Driven Java Development - Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.