Answer:

The answer follows.

Forward Order StringBuffer

class Tester
{
  public boolean test( String trial )
  {
    String lower = trial.toLowerCase();

    StringBuffer azBuffer  = new StringBuffer();

    for ( int j=0; j < lower.length(); j++ )
    {
       char c = lower.charAt(j);
       if ( c >= 'a' && c <= 'z' )
         azBuffer.append( c );
    }

    String forward  = azBuffer.;
    String backward = azBuffer. .  ;
    . . . .
  }
}

public class PalindromeTester
{
  . . . . .
}

After the for loop, azBuffer contains the alphabetic characters in their original order, bu converted to lower case. Now do this:

  1. Construct forward based on azBuffer.
  2. Reverse azBuffer.
  3. Construct backward based on the reversed azBuffer.

This can be done in two statements, using methods of StringBuffer.

QUESTION 11:

Fill in the blanks.