I'm working on a rather larger project and this is just included in it. Basically I created a class that takes an employee's info, we need to have it so the user must enter in a double for their pay rate. Say 8.00. Note the user CANNOT add in a dollar sign such as $8.00, else it will prompt the user an error has occured. Yet when I test run the code, instead of using the error prompt, the code simply crashes.
public static double getPayRate()
{
double payRate;
System.out.println("Please enter the employee's pay rate (a numeric value): ");
payRate = console.nextDouble();
while(console.hasNextDouble())
{
System.out.println("An error occured with your input...");
System.out.println("Please enter the employee's pay rate (a numeric value): ");
payRate = console.nextDouble();
}
return payRate;
}
}