To complete Challenge 53, the following code must be pasted into BlueJ™:
public class FlyingOstrich implements FlyingObject
{
public void fly()
{
System.out.println("The ostrich gets a running start.");
System.out.println("It starts to flap its wings.");
System.out.println("The ostrich picks up its speed…");
if (!isFlying())
{
System.out.println("…and nothing happens.");
}
else
{
System.out.println("…and runs onto an airplane.");
}
System.out.println("\nOSTRICHES CANNOT FLY!");
}
public boolean isFlying()
{
return false;
}
}
−Phoenix
Love it! 200 XPs awarded for completion.
ReplyDelete