-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBankAccountTest.java
More file actions
45 lines (41 loc) · 1.35 KB
/
BankAccountTest.java
File metadata and controls
45 lines (41 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
public class BankAccountTest {
public static void main(String[] args) {
try {
BankAccount account = new BankAccount("GB821234", 1000.00);
System.out.println(account);
} catch (BankException e) {
System.err.println(e.getMessage());
System.err.flush();
}
try {
} catch (BankException e) {
System.err.println(e.getMessage());
System.err.flush();
}
try {
BankAccount account = new BankAccount("GB821234", 500.00);
account.deposit(200.00);
System.out.println(account);
account.deposit(-50.00);
} catch (BankException e) {
System.err.println(e.getMessage());
System.err.flush();
}
try {
BankAccount account = new BankAccount("GB821234", 300.00);
account.withdraw(100.00);
System.out.println(account);
account.withdraw(250.00);
} catch (BankException e) {
System.err.println(e.getMessage());
System.err.flush();
}
try {
BankAccount account = new BankAccount("GB821234", 300.00);
account.withdraw(-100.00);
} catch (BankException e) {
System.err.println(e.getMessage());
System.err.flush();
}
}
}