Hello Everyone,
You will probably find this question stupid, but as a newbie to java, my head is about to explode.
I am working on my final assignment for my Java Introduction course and am stuck with this one thing. I need the user to either enter a number between 1 and ?? or 'Q' to quit.
This is what I have tried,
//starts the coordinate questions and answers System.out.println("Please pick a spot."); Scanner xLocate = new Scanner(System.in); Scanner yLocate = new Scanner(System.in); do { System.out.print("Column Location, Please choose a number between 1 and " + (gridSizeMax - 1) + ", or Q to quit. >> "); input = xLocate.nextInt(); if (input % 1 != 0){ String newInput = Integer.toString(input); System.exit(-1); } xLocation = input; } while (xLocation >= gridSizeMax || xLocation < GRID_SIZE_MIN);
I have also tried a Try/Catch and was unsuccessful there as well. I probable used it wrong anyways as we have not got to that in my course yet.
Looking for suggestions, if possible, not looking for the code, I will not learn anything if the code is given to me , just someone to point me in the right direction.
Thanks,