-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBankTester.java
More file actions
80 lines (73 loc) · 2.45 KB
/
BankTester.java
File metadata and controls
80 lines (73 loc) · 2.45 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
public class BankTester {
public static void main(String[] args) {
BankAccount b1 = new BankAccount(5125511,"APCS");
BankAccount b2 = new BankAccount(4124717, "ILikeTrains");
// System.out.println(b1.getBalance());
System.out.println(b1.getAccountID());
// System.out.println(b1.deposit(-10));
// System.out.println(b1.deposit(500));
// System.out.println(b1.getBalance());
// System.out.println(b1.withdraw(-10));
// System.out.println(b1.withdraw(600));
// System.out.println(b1.withdraw(200));
// System.out.println(b1.getBalance());
// System.out.println(b1.toString());
System.out.println(b1);
b1.deposit(-10);
b1.deposit(500);
System.out.println(b1);
b1.withdraw(-10);
b1.withdraw(600);
b1.withdraw(200);
System.out.println(b1);
b1.deposit(10000);
b1.transferTo(b2,500 ,"APCS");
System.out.println(b1);
System.out.println(b2);
b1.transferTo(b2, 50000, "APCS");
System.out.println(b1);
System.out.println(b2);
b1.setPassword("IAlsoLikeTrains");
b1.transferTo(b2,500 ,"APCS");
System.out.println(b1);
System.out.println(b2);
}
}
// public class BankTester{
// public static void main(String[]args){
// BankAccount b1 = new BankAccount(1000001, "abc123");
// BankAccount b2 = new BankAccount(1000231, "abcasdg23");
//
// System.out.println("Account b1:");
// b1.deposit(3000.0);
// b2.deposit(1234.0);
// System.out.println(b1);
// System.out.println("Account b2:");
// System.out.println(b2);
// System.out.println();
//
//
// double cashAmount = 300.0;
// while(cashAmount < 3000){
// System.out.println("Attempt to move $"+cashAmount+" from the b1 to b2 account:");
// if(b1.withdraw(cashAmount) ){
// if(b2.deposit(cashAmount)){
// System.out.println(b1);
// System.out.println(b2);
// System.out.println();
//
// }else{
// //This should never happen.
// //Error message provided to make sure that is the case
// System.out.println("CRITICAL ERROR! $"+cashAmount +
// " withdrawn from Account #" + b1.getAccountID() +
// "Failed to add to Account #"+b2.getAccountID());
// }
// }else{
// System.out.println("Transfer Failed");
// }
//
// cashAmount *= 2;
// }
// }
// }