Therapist - answer""but the question should be...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
// Hangmin Zhu [email protected] import; import; import*; public class Therapist { public static void main (String[] args) throws IOException { String[] reply = {"Not today!", "Absolutely!", "Ask your Mother", "In your dreams", "It's not looking good. ..", "I don't think so.", "Are you kidding?", "Not in this lifetime!", "That would be swell", "Why not?", "I really don't care either way. ..", "Yes", "No"}; System.out.println("Hangmin Zhu hzhu4"); System.out.println("Plz type 'EXIT' when you wanna terminate your session."); System.out.println("You may enter a question for the theraprist to
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: answer," +"but the question should be phrased such that it could be answered with a 'Yes' or 'No'."); InputStreamReader isr = new InputStreamReader (; BufferedReader br = new BufferedReader(isr); while(true) { String input = br.readLine().trim(); // wait for ENTER key if (input.length() == 0) continue; if (input.equalsIgnoreCase("EXIT")) return; int index = (int) (Math.random()*reply.length); String answer = reply[index]; System.out.println(answer); } } }...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online