Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2017
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. public class MinMaxAccount extends BankAccount {
  2. public int minBalance;
  3. public int maxBalance;
  4. private int currentBalance;
  5. public MinMaxAccount (Startup s) {
  6. super();
  7. minBalance = 0;
  8. maxBalance = 0;
  9. }
  10.  
  11. public void debit(Debit d) {
  12. currentBalance = this.getBalance();
  13. super();
  14. if (this.getBalance() > currentBalance) {
  15. maxBalance = this.getBalance();
  16. }
  17. }
  18.  
  19. public void credit(Crebit c) {
  20. currentBalance = this.getBalance();
  21. super();
  22. if (this.getBalance() < currentBalance) {
  23. minBalance = this.getBalance();
  24. }
  25. }
  26.  
  27. public int getMin(){
  28. return this.minBalance;
  29. }
  30.  
  31. public int getMax(){
  32. return this.maxBalance;
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement