Ok, I'm taking a Comp. Prog. class at my high school and the teacher that "teaches" the class knows practically nothing about programming. I joined the Java UIL team and am teaching the class with curriculum from some college website. Anyways, I started writing a Body Mass Index Calculator yesterday, and have had success but my problem is that I want to have a println
prompt to run the program again after the calculations have been completed. Now, I have learned the Do While
loop for this occasion, but my problem is with the scanner. I want to receive input as a string but when I do
String a = sc.nextLine();
outside of the do
, it says that y
or yes
, cannot be resolved to a variable. A friend suggested switch cases
, what do you think? I use Eclipse BTW.
String a = sc.nextLine();
do{
wow(); //My method name
}while(a == y); //Error is here