Suppose I want to make a Jeroo (named "dave") hop if he is facing west. And, if the Jeroo is not facing west, I want the Jeroo turn to the right. What is the proper way to write this in Java? (Note that some answers may compile, but are not proper.)
if (dave.isFacing(WEST))
{
dave.hop();
}
else
{
dave.turn(RIGHT);
}
if dave.isFacing(WEST)
{
dave.hop();
}
else
{
dave.turn(RIGHT);
} if (dave.isFacing(WEST)
dave.hop();
else
dave.turn(RIGHT); if (dave.isFacing(WEST));
{
dave.hop();
}
else;
{
dave.turn(RIGHT);
} There are not hints for this question