Listing 1. Source code for the program named Alice0150a.

Alice0150a's Code

Created by: Dick Baldwin

world

Methods

  public void main ( ) {
    
       // Copyright 2007 R.G.Baldwin
  // The real purpose of this program is to define and
  // save a new class named SpinningHare.a2c
  // This class adds a method named spin to the standard
  // Hare class. Objects of this class can be created
  // and added to a world by importing the class
  // from the File menu.
  hare .move( BACKWARD , 0.5 meters );
  hare.spin ( numberRevs = 10 , duration = 10 );
  hare .move( FORWARD , 0.5 meters );
  }


hare

Methods

  public void spin ( Number numberRevs, Number duration) {
    
       // This method is added to the Hare class to create
  // a new class named SpinningHare.
  hare .turn( LEFT , numberRevs revolutions ); duration = duration seconds
  }