My main method for this program, which runs the readInput and writeOutput methods, is in a different java file. My question is as follows.
Why is Java giving me an out of bounds exception at lines 31 and 32 before I can even enter a string? I'm trying to store the first character of the string as a char to use it in the following "if, else if, else" statement.
Any hints as to what might be the problem? I'm willing to bet it's something simple that I accidentally glossed right over while typing this up.
For those who cannot get the link to work, the code is as follows.
System.out.println("Is the nature increase, decrease, or neutral?");
char nature;
nature = keys.nextLine().toLowerCase().charAt(0);
if(nature=='i')
natureMult=1.1;
else if(nature=='n')
natureMult=1.0;
else if(nature=='d')
natureMult=0.9;
else
{
System.out.println("Error! You entered an invalid multiplier!");
System.exit(0);
}