Sorry about that here's the edit:
I am trying to get user inputs (double types). so when i get a letter instead of a double i get an exception even though i had a while loop checking for this. so i looked up how to do exception handling and now when i get to that point it catches it but only outputs the message i gave and terminates instead of going through the while loop again. apparently there is no way to go back to before the error happened unless you use a while loop. but the loop isn't working it just terminates.
here's the code:
public static void collectInfo() { double firstW=0; double secondW=0; double payRate =0; double holiHours =0; boolean firstWGood = true; boolean secondWGood = true; boolean payRateGood = true; boolean holiHoursGood = true; Scanner in = new Scanner (System.in); do{ try{ System.out.println("Enter hours received for the first week of your paycheck. "); System.out.println("If you have overtime, just add it to this for example: 3 hours of overtime is 43 hours that week"); firstW = in.nextDouble(); firstWGood = false; } catch (InputMismatchException e){ System.out.println("Oops..."); } }while(!firstWGood);
and here's the output when i ran the program(console):
Enter hours received for the first week of your paycheck.
If you have overtime, just add it to this for example: 3 hours of overtime is 43 hours that week
h
Oops...