Fixed bugs.

deliverable_2
asdfasdf 6 years ago
parent d3f2297d27
commit 15f2aac1a8

@ -15,6 +15,7 @@ public class Main {
//options = new Options(); //options = new Options();
System.out.println("Welcome to " + PROGRAM_NAME + "!"); System.out.println("Welcome to " + PROGRAM_NAME + "!");
guess(); guess();
end();
} }
// java main // java main
@ -40,8 +41,16 @@ public class Main {
public int getUserInt() { public int getUserInt() {
Scanner scan = new Scanner(System.in); Scanner scan = new Scanner(System.in);
int result = scan.nextInt(); int result = 0;
scan.close(); while (true) {
if (scan.hasNextInt()) {
result = scan.nextInt();
break;
} else {
System.out.println("Try again?");
scan.nextLine();
}
}
return result; return result;
} }

Loading…
Cancel
Save