import javabook.*;

/*
 * Introduction to OOP with Java 2nd Edition, McGraw-Hill
 *	
 *   Construct a new sentence from input words with
 *   even number of letters.
 *  
 * @author Dr. Caffeine
 *
 */
class ReplaceVowelsWithX
{
    public static void main (String[] args)
    {
        MainWindow  mainWindow;
        OutputBox 	outputBox;
        InputBox    inputBox;
        
        mainWindow  = new MainWindow("Words with Even Number of Letters");
        outputBox   = new OutputBox( mainWindow );
        inputBox    = new InputBox( mainWindow );
                
        mainWindow.setVisible( true ); 
        outputBox.setVisible( true );
        
        boolean      repeat = true;
        
        String       word;
        
        StringBuffer tempStringBuffer = new StringBuffer("");
        
        while ( repeat ) {
            word = inputBox.getString("Next word:");
            
            if ( word.equals("STOP") ) 
              
              repeat = false;
              
            else if ( word.length() % 2 == 0 )
              
              tempStringBuffer.append(word + " ");
        
        }
              
        outputBox.printLine( "Output: " + tempStringBuffer );
                    
    }
    
}