aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Hunteman <michael@michaelted.xyz>2022-07-27 17:37:54 -0500
committerMichael Hunteman <michael@huntm.net>2023-03-07 11:06:52 -0600
commit800fc1664c94fd543151adf25bb2ce2e5a2f6c21 (patch)
tree50415a5e3b697943e81a61c31827e04d46589e67
parentad3cc8f08d0b629dfc68c97a81ee247a1795b518 (diff)
Add error handling for buying power
-rw-r--r--picker.java6
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);