Advertisement
Guest User

Untitled

a guest
Oct 20th, 2019
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. package Finance.Bank;
  2.  
  3. public class BankAccount {
  4.  
  5. private String name;
  6. private static double interestRate = 0.5;
  7. private int days;
  8. private static double balance;
  9.  
  10. public BankAccount(String name, double amount) {
  11.  
  12. this.name = name;
  13. balance = amount;
  14.  
  15. }
  16.  
  17. public double deposit(double amount) {
  18.  
  19. balance = balance + amount;
  20. return balance;
  21.  
  22. }
  23.  
  24. public double Withdraw(double amount) {
  25. balance = balance - amount;
  26. return balance;
  27. }
  28.  
  29. public void displayInfo() {
  30. // TODO Auto-generated method stub
  31.  
  32. }
  33.  
  34. public static void setInterestRate(double interestRate) {
  35.  
  36. balance = balance + balance * interestRate;
  37. }
  38.  
  39. public static double getInterestRate() {
  40.  
  41. return interestRate;
  42. }
  43.  
  44. public double calculateInterest(int days) {
  45. // TODO Auto-generated method stub
  46. balance = Math.pow(balance * (1 + interestRate), days);
  47.  
  48. return 0;
  49. }
  50.  
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement