I'm having an issue with the while loop repeating after the user replies yes, which should repeat the program, but instead it skips through the body and immediately asks the last question again.
Here is a portion of the program (Type in amphibian when it asks for the monster class):
public class MH4 {
public static void main(String[] args) {
String answer = "yes";
String monster, amphibian;
String s2 = "Water", s3 = "Thunder";
String b1 = "Head", b2 = "Front legs", b4 = "Hind legs";
String f3 = "Fatigue", i1 = "Ice Blight", i2 = "Severe Ice Blight";
Scanner keyboard = new Scanner(System.in);
while (answer.equalsIgnoreCase("yes")) {
System.out.println("Which monster class do you want to look up?");
monster = keyboard.nextLine();
if (monster.equalsIgnoreCase("Amphibian")){
System.out.println("\nThese are the monsters under that classification:\n");
System.out.println("Tetsucabra\nBerserk Tetsucabra\nZamite\nZamtrios\nTigerstripe Zamtiros");
System.out.println("\nWhich of these monsters would you like to gather information on?");
amphibian = keyboard.nextLine();
if (amphibian.equalsIgnoreCase("Tetsucabra"))
System.out.println("\nThis monster is weakest to: " + s2 + " and " + s3);
System.out.println("\nThis monster's weakest point is its: " + b1 + ", " + b2 + ", and " + b4);
System.out.println("\nThis monster can cause:\n" + f3 + "\n" + i1 + " *\n" + i2 + " *\n");
System.out.println("* Tetsucabra only inflicts these while in the frozen seaway");
System.out.println("\nImportant Notes:\n- Its tail becomes its weakest point while it is holding boulders.\n- The projectiles that it shoots drain stamina.");
}
else {
System.out.println("That monster class does not exist in this game.");
}
System.out.println("\nIs there another monster or monster class you wish to look up?");
answer = keyboard.next();
}
}
}
If you can figure out the error please let me know, as I have no idea what it could be.