g964: The example is correct (and very useful); the description's wording is certainly inaccurate, however.
To be fair, I think a lot of people learnt a few things from solving this kata: Always be very careful when reading (or writing) your problem description; use tests and logging to make sure the behaviour of your code matches with the expected reality!
Depreciation is not something that suddenly occurs at a single moment. It is a process that takes place over a period of time.
If depreciation rate increases in the end of a month (say Feb 28 23:59), that normally means it will only start excercising its depreciating effect from March 01, 0:00 on.
So, according to description, if rate changes end of second month, then first 2 months must be discounted/depreciated at a rate of 1.5.
A theoretical case can be made that the amortisation rate is not from regular wear, but from somebody with a crowbar smashing the car in very regular intervals just before end of month. But no talk of such thing in the description.
jimmy.clayton is correct in their 1. remark.
g964: The example is correct (and very useful); the description's wording is certainly inaccurate, however.
To be fair, I think a lot of people learnt a few things from solving this kata: Always be very careful when reading (or writing) your problem description; use tests and logging to make sure the behaviour of your code matches with the expected reality!
Depreciation is not something that suddenly occurs at a single moment. It is a process that takes place over a period of time.
If depreciation rate increases in the end of a month (say Feb 28 23:59), that normally means it will only start excercising its depreciating effect from March 01, 0:00 on.
So, according to description, if rate changes end of second month, then first 2 months must be discounted/depreciated at a rate of 1.5.
A theoretical case can be made that the amortisation rate is not from regular wear, but from somebody with a crowbar smashing the car in very regular intervals just before end of month. But no talk of such thing in the description.
jimmy.clayton is correct in their 1. remark.
False pass.
My code contains a die;
I must have accidentally hit submit.
Wrong; the description says:
"766 is the nearest integer to 766.158... (rounding 766.158 gives 766)."
wrong:
wrong:
In summary,
This comment is hidden because it contains spoiler information about the solution