summaryrefslogtreecommitdiff
path: root/oop/02-inheritance/CheckingAccount.java
blob: a7c19b84c9eb396df3886fc65118a095fb90af73 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
public class CheckingAccount extends Account {
	
	
	protected double overdraftLimit;


	public void withdraw(double amount) {
		double finalBalance = balance - amount;
		if (finalBalance < 0) {
			if (-finalBalance <= overdraftLimit) {
				balance = finalBalance;
			} else {
				// throw exception
			}
		} else {
			balance =  finalBalance;
		}
	}
}