There’s a spelling mistake (an extra ‘e’ on the input parameter annualInterest*e*Rate):
public void setAnnualInterestRate(double annualInteresteRate){
this.annualInterestRate = annualInterestRate;
}
Therefore you are setting the this.annualInterestRate
to itself, which was set to be 0.0 in the constructor. Should be:
public void setAnnualInterestRate(double annualInterestRate){
this.annualInterestRate = annualInterestRate;
}
You are also never assigning a creation date to dateCreated
, hence the null. I suggest setting it inside the constructor (as this will be called any time you create a new Account object).
annualInterestRate = 0.0;
And then you calc monthtly interest dividing annual by 12.
0/anything except 0 is 0.
That’s why
Your constructors aren’t set up properly.
public Account()
public Account(int id, double balance)
public Account (int newId, double newBalance, double newAnnualInterestRate)
All of them are lacking a Date initialization.
this.dateCreated = new Date(); // Add this to each constructor
You’re also lacking a method for calculating the interest generated each month, need to write that as well. getMonthlyInterest() is different from getMonthlyInterestRate(), which is what you’re currently doing.
There should be an earlier assignment in your textbook that shows you how to calculate the monthly interest (again not the RATE, the amount) given the annual interest rate.