Thursday, October 08, 2009

ICA-CP: Sample TerminalIO program

import TerminalIO.KeyboardReader;
class MyEliza
{ // begin class
public static void main (String[] args)
{ // end class

// declare variables here
KeyboardReader userAnswer = new KeyboardReader();
boolean Done;
final String DoneString = "Done";

while (Done == false)
{ // begin while
System.out.println ("Tell the parrot all!");
userAnser = ReadLine();
if (userAnswer.equals(DoneString))
{ // begin if
Done = true;
} // end if
if (Done == false)
{ // begin if
System.out.println ("You said: " + userAnswer);
} // end if
} // end while
} // end main
} // end class

0 Comments:

Post a Comment

<< Home