Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class MinMaxAccount extends BankAccount {
- public int minBalance;
- public int maxBalance;
- private int currentBalance;
- public MinMaxAccount (Startup s) {
- super();
- minBalance = 0;
- maxBalance = 0;
- }
- public void debit(Debit d) {
- currentBalance = this.getBalance();
- super();
- if (this.getBalance() > currentBalance) {
- maxBalance = this.getBalance();
- }
- }
- public void credit(Crebit c) {
- currentBalance = this.getBalance();
- super();
- if (this.getBalance() < currentBalance) {
- minBalance = this.getBalance();
- }
- }
- public int getMin(){
- return this.minBalance;
- }
- public int getMax(){
- return this.maxBalance;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement