-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCustomerCurrentAccount.java
More file actions
46 lines (35 loc) · 941 Bytes
/
Copy pathCustomerCurrentAccount.java
File metadata and controls
46 lines (35 loc) · 941 Bytes
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
import java.util.List;
public class CustomerCurrentAccount extends CustomerAccount {
private ATMCard atm;
private double overdraft;
public CustomerCurrentAccount() {
super();
this.atm = null;
this.overdraft = 0.0;
}
public CustomerCurrentAccount(ATMCard atm, String number, double balance) {
super(number, balance);
this.atm = atm;
this.overdraft = 0.0;
}
public ATMCard getAtm() {
return atm;
}
public void setAtm(ATMCard atm) {
this.atm = atm;
}
public double getOverdraft() {
return overdraft;
}
public void setOverdraft(double overdraft) {
this.overdraft = overdraft;
}
@Override
public boolean withdraw(double amount) {
if(getBalance() + overdraft >= amount) {
setBalance(getBalance() - amount);
return true;
}
return false;
}
}