diff options
author | Michael Hunteman <michael@michaelted.xyz> | 2022-07-27 17:37:54 -0500 |
---|---|---|
committer | Michael Hunteman <michael@huntm.net> | 2023-03-07 11:06:52 -0600 |
commit | 800fc1664c94fd543151adf25bb2ce2e5a2f6c21 (patch) | |
tree | 50415a5e3b697943e81a61c31827e04d46589e67 | |
parent | ad3cc8f08d0b629dfc68c97a81ee247a1795b518 (diff) |
Add error handling for buying power
-rw-r--r-- | picker.java | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/picker.java b/picker.java index d9de0f1..4d12ac3 100644 --- a/picker.java +++ b/picker.java @@ -114,7 +114,11 @@ class Backpointer { case 2: System.out.println("How much money do you have to " + "allocate?"); - priceLimit = Integer.parseInt(scanner.nextLine()); + try { + priceLimit = Integer.parseInt(scanner.nextLine()); + } catch (NumberFormatException e){ + System.out.println("Invalid input - must enter: #"); + } break; case 3: System.out.println(choices); |