Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

interest-is-interesting: years before reaching desired balance when targetBalance <= balance #1976

Open
tomrijnbeek opened this issue Sep 21, 2022 · 0 comments

Comments

@tomrijnbeek
Copy link
Contributor

The "Interest is Interesting" currently does not have a test case for task 4 where the target balance has been met by the balance already. If you target savings is 1000, but your balance is already - say - 1200, I would expect the method to return "0": the target has already been met.

I have seen implementations using a do-while loop, which would return 1 at the very least, whereas a while loop would return 0. Both currently pass as tests.

I would propose to add two test cases: one where the target balance is equal to the balance, and where the target balance is less than the balance. Both of which should return 0. Furthermore, the instructions should probably clarify that this is expected behaviour (as a hint perhaps?)

Happy to create a PR for this, but wanted to check whether this is indeed the desired behaviour first. This particular task does not appear to be present in other tracks that have the interest-is-interesting exercise, so I did not have any comparison material.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant