Have no fear symptom man is here!

Here is the solution that you guys have led me to come up with for that annoying sym;ptom question. Hope you find many errors in it an belittle me ^^;

import java.util.*;

import java.text.*;

publicclass Medicine

{

publicstaticvoid main(String[]args)

{

String answer, ansCold;

int symptom;

Scanner scan=new Scanner(System.in);

do{

System.out.println("1. Do you have a headache?");

System.out.println("2. Are yu having trouble sleeping at night?");

System.out.println("3. Do you have a stomahc ache?");

symptom=scan.nextInt();

if(symptom==1)

{

System.out.println("You need tylenol or asprin");

}

if(symptom==2)

{

System.out.println("Are you experiencing a cold also?:");

ansCold=scan.nextLine();

if(ansCold.equalsIgnoreCase("yes"));

{

System.out.println("You need Niquill :)");

}

}

if(symptom==3)

{

System.out.println("You need Pepto-Bismal");

}

else

System.out.println("I'm sorry i did not find any medicine which will meed your symptom");

System.out.println("Would you like to try again?");

answer=scan.next();

}while(answer.equalsIgnoreCase("y"));

}

}

You like eh?

[2477 byte] By [Progr@mera] at [2007-11-26 12:21:20]
# 1

1. Do you have a headache?

2. Are yu having trouble sleeping at night?

3. Do you have a stomahc ache?

diarrhea

Exception in thread "main" java.util.InputMismatchException

at java.util.Scanner.throwFor(Scanner.java:819)

at java.util.Scanner.next(Scanner.java:1431)

at java.util.Scanner.nextInt(Scanner.java:2040)

at java.util.Scanner.nextInt(Scanner.java:2000)

at Test.main(Test.java:18)

Press any key to continue...

And you spelled Medecine wrong. ;-)

CaptainMorgan08a at 2007-7-7 15:12:45 > top of Java-index,Archived Forums,Socket Programming...
# 2
Any particular reason why you open a new thread and don't continue your old one? http://forum.java.sun.com/thread.jspa?threadID=5114859&tstart=0
Joerg22a at 2007-7-7 15:12:45 > top of Java-index,Archived Forums,Socket Programming...
# 3
When I choose 1 or 2, it always gives me:I'm sorry i did not find any medicine which will meed your symptom
CaptainMorgan08a at 2007-7-7 15:12:45 > top of Java-index,Archived Forums,Socket Programming...