Notes on programming with good style by ___________________________
Take this jumbled together program to walk around the island perimeter and rewrite it. Divide it into Jeroo methods, using indentation and comments.
Problem Description: Walk all the way around the perimeter of a square island with no obstacles starting in the northwest corner facing east and returning to the original position facing east.
method main()
Jeroo sally= new Jeroo();
while(!sally.isWater(AHEAD)){
sally.hop();}
sally.turn(RIGHT);
while(!Sally.isWater(AHEAD)){
sally.hop();}
sally.turn(RIGHT);
while(! sally.isWater(AHEAD))
{sally.hop();
}
sally.turn(RIGHT);
while(!sally.isWater(AHEAD)){
sally.hop();}
sally.turn(RIGHT);
}
This could be your the main method: (with Jeroo methods and comments added of course!)