AllTheTimeWorld.com

alice mathMonkey jumps for banana

Monkey jumps for banana

Monkey jumps a bit higher each time by multiplying variable by 1.3

Monkey jumps for banana

Monkey jumps a bit higher each time by multiplying variable by 1.3


Text of video
public void myFirstMethod() {
    //Programmer : Janet Joy
    //Monkey jumps for banana
    //Monkey reaches up with both arms
    this.goldenMonkey.getRightShoulder().turn( TurnDirection.LEFT, 0.35 );
    this.goldenMonkey.getLeftShoulder().turn( TurnDirection.RIGHT, 0.4 );
    //Monkey jumps 0.25
    Double amountToJump = 0.25;
    this.goldenMonkey.move( MoveDirection.UP, amountToJump );
    this.goldenMonkey.move( MoveDirection.DOWN, amountToJump );
    amountToJump = amountToJump*1.3;
    //Jump a little bit higher : amountToJump is now 0.325
    this.goldenMonkey.move( MoveDirection.UP, amountToJump );
    this.goldenMonkey.move( MoveDirection.DOWN, amountToJump );
    amountToJump = amountToJump*1.3;
    //Jump a little bit higher : amountToJump is now 0.4225
    this.goldenMonkey.move( MoveDirection.UP, amountToJump );
    this.goldenMonkey.move( MoveDirection.DOWN, amountToJump );
 }