Vote count:
0
This all looks good to me. The class runs but when I type something into the scanner nothing happens. its supposed to have the input be registered and ran through another class where then i get the response and try to print it.
import java.io.File; import java.util.Scanner;
public class Eliza {
/**
* Main Eliza program that processes user input & responds
*/
public static void main(String[] args) {
String line = ""; // variable to hold user input
String response = ""; // variable to hold eliza's response
ElizaResponder responder = new ElizaResponder();
// 1. Print welcome -- TODO add your name instead----DONE
System.out.println("Welcome to Christian Rebelo's Eliza");
System.out.println("---------------------------");
// Print Eliza's initial greeting to start the conversation
System.out.println("ELIZA> " + responder.getGreeting());
// 2. Create scanner object (TODO)------DONE
Scanner s = new Scanner(System.in);
// Continuously run question-response pattern until
// user indicates they're finished by entering:
// bye, goodbye, done, exit, or quit
while (responder.isNotFinished()) {
// 3. Use scanner to get next line of user input (TODO)----DONE
line = s.nextLine();
}
// 4. Get Eliza's response (TODO)----DONE
response = responder.getResponse(line);
// 5. Display (print) Eliza's response to user (TODO)----DONE
System.out.println(response);
// Print Eliza's farewell----DONE
System.out.println("ELIZA> " + responder.getFarewell());
}
}
asked 42 secs ago
Aucun commentaire:
Enregistrer un commentaire