Advertisement
Guest User

Untitled

a guest
Feb 14th, 2016
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. //Author: Stephanie Santizo
  2. public class MinMaxAccount extends BankingAccount{
  3. private int min;
  4. private int max;
  5. public MinMaxAccount(Startup s){
  6. super(s);
  7. min = s.startup_getBalance();
  8. max = s.startup_getBalance();
  9. }
  10. public void debit(Debit d){
  11. super.debit(d);
  12. int balance = getBalance();
  13. if(balance < min){
  14. min = balance;
  15. }
  16. if(balance > max){
  17. max = balance;
  18. }
  19. }
  20. public void credit(Credit c){
  21. super.credit(c);
  22. int balance = getBalance();
  23. if(balance < min){
  24. min = balance;
  25. }
  26. if(balance > max){
  27. max = balance;
  28. }
  29. }
  30. public int getMin(){
  31. return min;
  32. }
  33. public int getMax(){
  34. return max;
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement