Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Eliza {
- public static void main(String[] args) {
- System.out.println("Eliza: Hello, my name is Eliza. What is your name?");
- Scanner scn = new Scanner (System.in);
- String user;
- System.out.print("User: ");
- user = scn.nextLine();
- System.out.printf("Eliza: Hello, %s. Tell me what is on your mind today in 1 sentence.\n", user);
- do {
- conversation(scn);
- }while (rerun(scn));
- }
- public static boolean rerun(Scanner scan) {
- System.out.println("ELIZA: Do you want to run the session again?");
- String cont = "";
- while (true) {
- cont = scan.next().toLowerCase();
- if ("Yes".compareTo (cont) == 0) {
- return true;
- } else if ("No".compareTo (cont) == 0) {
- return false;
- } else {
- System.out.println("Invalid choice.");
- }
- }
- }
- public static void conversation(Scanner scan) {
- String ans;
- ans = scan.nextLine();
- for(int i=0; i<= ans.length()-1;i++) {
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement