I've only just started learning programming in Java and I cannot figure out how to store a value from user input as a double.
Here's my code:
package FirstProject;
import java.util.Scanner;
public class TripPlanner {
public static void main () {
Scanner console = new Scanner(System.in);
System.out.print("How many " + currencySymbol + " are there in 1 USD? ");
double conversion = console.nextDouble();
}
}
I don't understand why when I enter, for example 19.5, it gives me exception error. My understanding is that I defined the conversion variable as double (double conversion) and I expect the user to enter a double (console.nextDouble();). It's fundamental but coming from Python I can't understand what I'm doing wrong.