Issue with savings_account interest_rate test

Problems

  • The current test for SavingsAccount.interest_rate is written to expect a fixed value of 0.5 for balances less than 1000. This contradicts the exercise specification which emphasizes an interest rate of 0.5% ~ 0.005.

Posible solution

  • Kindly change the expected value to 0.5% ~ 0.005 of the balance for balances less than 1000.

Thank you

Where do you see it emphasize a delta? Are you referring to the unit test? Those are there to handle any rounding issues. The instruction say 5% and that is what you’re expected to implement. If you implement that, the tests should pass fine.

0.5% for a non-negative balance less than 1000 dollars.

I am refering to the unit test actually.
The test is expecting

SavingsAccount.interest_rate(200.75)
#=> 0.5

Meanwhile the instruction you quoted states 0.5% which is 0.005. So the test is ignoring the percentage in the interest_rate method however, expects the implementation of the percentage in the remaing two methods.

If I want to know my annual earnings, I need to multiply my rate by my balance. (rate * balance) and if the rate is 0.5 instead of 0.005 for less than 1000 dollars, my anual earning will be wrong.

0.5% is 0.5 (percent) or 0.005/year or 0.04%/month, etc. There are many ways to represent the interest rate. The documentation is showing that interest_rate is meant to return the interest rate as the percent-per-year value, i.e. it expects the function to return the value 0.5 when the interest rate is 0.5% per year.

How this value is used in other functions is part of implementing other functions. You may need to divide the rate by 100 for it to be useful. It might arguably be more useful if the function returned 0.5% as 0.005. But that’s a design choice and this exercise is explicitly designed this way. Is this the best design? Is this how I’d design this function in a production library? Maybe not. Is there any inconsistencies in this exercise where the tests and instructions out not aligned? I don’t see any inconsistencies. Am I missing something somewhere?

@IsaacG, I understand your arguement and I appreciate it.

Thank you