import java.io.*; import java.text.*; public class doctor { public static void main(String [] args) throws IOException { boolean done=false; BufferedReader in =new BufferedReader (new InputStreamReader(System.in)); String sentence="";//initialize word to NULL System.out.println("The doctor is in! "); System.out.println("Tell me what you are feeling " + "or enter \"bye\" to quit."); String word1="LOVE"; String word2="HATE"; String word3="MONEY"; String word4="SCHOOL"; String word5="PROFESSOR"; String word6="WOMEN"; String word7="MEN"; String word8="WORK"; String word9="BYE"; String answer1="Do you have these feelings often?"; String answer2="Hate is a strong emotion. Tell me about it."; String answer3="Why does money worry you?"; String answer4="Do you study enough?"; String answer5="What is the problem with the professor?"; String answer6="Well, they are the superior gender!"; String answer7="Too bad we can't send them all to the moon!"; String answer8="All work and no play makes Jack a dull boy!"; String answer9="You are making progress. Tell me more."; do { sentence=in.readLine(); sentence=sentence.toUpperCase(); //call the method to convert case if(sentence.indexOf(word1)!=-1) System.out.println(answer1); else if(sentence.indexOf(word2)!=-1) System.out.println(answer2); else if(sentence.indexOf(word3)!=-1) System.out.println(answer3); else if(sentence.indexOf(word4)!=-1) System.out.println(answer4); else if(sentence.indexOf(word5)!=-1) System.out.println(answer5); else if(sentence.indexOf(word6)!=-1) System.out.println(answer6); else if(sentence.indexOf(word7)!=-1) System.out.println(answer7); else if(sentence.indexOf(word8)!=-1) System.out.println(answer8); else if(sentence.indexOf(word9)!=-1) done=true; else System.out.println(answer9); } while(!done);//while(done==false); System.out.println("Your bill is $100. Have a nice day!"); } }