Created
April 18, 2017 18:36
-
-
Save charlesreid1/78f4e3c5a970839b174454240b72afef to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MinMaxAccount extends BankAccount { | |
private double minBalance; | |
private double maxBalance; | |
public MinMaxAccount(Startup s) { | |
super(s); | |
this.minBalance = getBalance(); | |
this.maxBalance = getBalance(); | |
} | |
public void debit(Debit d) { | |
super.debit(d); | |
double balance = getBalance(); | |
if(balance < this.minBalance) { | |
this.minBalance = balance; | |
} | |
} | |
public void credit(Credit c) { | |
super.credit(c); | |
if(getBalance() > this.maxBalance) { | |
this.maxBalance = getBalance(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment