Advertisement
sunspeak

Untitled

Oct 21st, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. import java.util.ArrayList;
  2.  
  3. public class BankAccount
  4. {
  5. private final static double DEFAULT_INTEREST_RATE = 0.02;
  6. private int id;
  7. private double balance;
  8. private static double interestRate = DEFAULT_INTEREST_RATE;
  9. private static int bankAccount = 1;
  10. ArrayList idUsers = new ArrayList();
  11. BankAccount()
  12. {
  13. this.id = bankAccount++;
  14. }
  15. static void setInterestRate(double interestRate)
  16. {
  17. BankAccount.interestRate = interestRate;
  18. }
  19. void deposit(double amount)
  20. {
  21. this.balance += amount;
  22. }
  23. double getInterest (int years)
  24. {
  25. return BankAccount.interestRate * years * this.balance;
  26. }
  27. public void setIdUsers()
  28. {
  29. this.idUsers.add("Id"+ id);
  30. this.id = bankAccount ++;
  31.  
  32. }
  33.  
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement