|
@@ -1,5 +1,6 @@
|
1
|
1
|
package rocks.zipcode.atm.bank;
|
2
|
2
|
|
|
3
|
+import javafx.scene.control.Alert;
|
3
|
4
|
import rocks.zipcode.atm.ActionResult;
|
4
|
5
|
|
5
|
6
|
import java.util.HashMap;
|
|
@@ -14,18 +15,18 @@ public class Bank {
|
14
|
15
|
|
15
|
16
|
public Bank() {
|
16
|
17
|
accounts.put(1000, new BasicAccount(new AccountData(
|
17
|
|
- 1000, "Example 1", "example1@gmail.com", 500
|
|
18
|
+ 1, "Doug Funny", "beetz@gmail.com", 500
|
18
|
19
|
)));
|
19
|
20
|
|
20
|
21
|
accounts.put(2000, new PremiumAccount(new AccountData(
|
21
|
|
- 2000, "Example 2", "example2@gmail.com", 200
|
|
22
|
+ 2, "Bugs Bunny", "WatsUpDoc@gmail.com", 200
|
22
|
23
|
)));
|
23
|
24
|
|
24
|
25
|
accounts.put(3000, new PremiumAccount(new AccountData(
|
25
|
|
- 3000, "Scooby Doo", "scoobs@gmail.com", 50
|
|
26
|
+ 3, "Scooby Doo", "scoobs@gmail.com", 50
|
26
|
27
|
)));
|
27
|
28
|
accounts.put(4000, new BasicAccount(new AccountData(
|
28
|
|
- 4000, "Road Runner", "beebbeeb@gmail.com", 2000
|
|
29
|
+ 4, "Road Runner", "beebbeeb@gmail.com", 2000
|
29
|
30
|
)));
|
30
|
31
|
}
|
31
|
32
|
|
|
@@ -35,7 +36,7 @@ public class Bank {
|
35
|
36
|
if (account != null) {
|
36
|
37
|
return ActionResult.success(account.getAccountData());
|
37
|
38
|
} else {
|
38
|
|
- return ActionResult.fail("No account with id: " + id + "\nTry account 1000 or 2000");
|
|
39
|
+ return ActionResult.fail("No account with id: " + id );
|
39
|
40
|
}
|
40
|
41
|
}
|
41
|
42
|
|
|
@@ -53,7 +54,11 @@ public class Bank {
|
53
|
54
|
if (ok) {
|
54
|
55
|
return ActionResult.success(account.getAccountData());
|
55
|
56
|
} else {
|
56
|
|
- return ActionResult.fail("Withdraw failed: " + amount + ". Account has: " + account.getBalance());
|
|
57
|
+ Alert alert = new Alert(Alert.AlertType.ERROR);
|
|
58
|
+ alert.setTitle("Overdraw!");
|
|
59
|
+ alert.setHeaderText("Not enough money!");
|
|
60
|
+ alert.setContentText("You do not have enough money in your account to complete this transaction.");
|
|
61
|
+ return ActionResult.fail("Insufficient Funds");
|
57
|
62
|
}
|
58
|
63
|
}
|
59
|
64
|
}
|