Tuesday, November 20, 2007

ICA-CP Class Info: Eliza Program

Here's what we're doing with the your Eliza programs. You should all be working on Stage 1 right now.

Stage 1: Your team should be creating a psychiatrist program that takes user input from the keyboard as one word, matches that word with your psychiatrist response, and displays that response on the screen. This means you need to use TerminalIO.KeyboardReader to get the user input. Here's the pseudo-code that was on the board yesterday:

import TerminalIO.KeyboardReader;
public class myEliza
{
public static void main (String[] args)
{
KeyboardReader reader = new KeyboardReader(); /* This instantiates an object with the
variable name of reader. */
String whatUserTyped = "hi"; /* Creates a string variable called whatUserTyped and initializes the value of whatUserTyped to "hi". */
whatUserTyped = reader.readLine(); // Get what the user typed at the keyboard
if (whatUserTyped.equals("happy")
{
System.out.println("Hurray for you!");
}
// Put the rest of you if statements with Eliza responses here.
} // close main
? // close class

Stage 2:
Once you get Stage 1 working, then add a while loop and other needed messages to your user that keeps taking user input until the user types the word, Done.

Stage 3: Now, add StringTokenizer so your user may type whole sentences, and your program is able to pick out the emotion word to display a response. We will go over StringTokenizer next week. But first, everyone in our class has to understand the basic Java syntax and OOP concepts.

Stage 4: Do the flow chart and documentation.

I'm changing the due date. All of the above is due on the last day of class for the semester. Also, the point value is changed. This is the whole of your semester project and is worth 150 instead of 75 points. No late work will be accepted because grades for the semester will be due from teachers.

0 Comments:

Post a Comment

<< Home