Why am I getting InputMismatchException?
Here you can see the nature of Scanner: double nextDouble() Returns the next token as a double. If the next token is not a float or is out of range, InputMismatchException is thrown. Try to catch the exception UPDATE CASE 1 I tried your code and there is nothing wrong with it. Your are getting that error … Read more