Listing 1. Source code for the program named Alice0165a.

Alice0165a's Code

Created by: Dick Baldwin

world

Methods

  public void main ( ) {
    Boolean testResult = true ; Number userInputValue = 1 ;
       // Copyright 2007, R.G.Baldwin
  // Uses if-else to test a user input value for even or odd.
  // Get user input.
  userInputValue .set( value , ( NumberDialog( question = Enter an integer. ) ) );
  // Compute remainder after dividing by 2 and return true
  // if remainder is equal to 0
  testResult .set( value , ( ( Math.IEEERemainder( userInputValue , 2 ) ) == 0 ) );
  // Execute the selection structure.
  if ( testResult ) {
       penguin .say( Even ); duration = 30 seconds
  } else {
    penguin .say( Odd ); duration = 30 seconds
  }
  }