Ad
  • Custom User Avatar
  • Custom User Avatar

    Which language?

  • Custom User Avatar

    Fixed, Thanks.

  • Custom User Avatar

    You can do the change of percentage when you want... but calculate with the correct one at the end of the month. Once more, description says:

    Calculations are processed at the end of each considered month

    My solution is not maybe the best but if you have time take a look at it:-)

  • Custom User Avatar

    Description:

    percent of loss increases by 0.5 percent at the end of every two months

    • So to make your calculations at the end of month 1 you use the initial loss
    • .............................at the end of month 2 you use the initial loss increased by 0.5 percent

    With the example given in the description
    nbMonths(2000, 8000, 1000, 1.5) should return [6, 766]
    you get for "months", "percentLossByMonth", "available" (rounded):

    1   1.5   -4910
    2   2.0   -3792
    3   2.0   -2676
    4   2.5   -1534
    5   2.5   -396
    6   3.0   766
    

    The thing to understand is: at each step you use the correct percentLossByMonth before doing your calculations. Is that clearer?