Calculating future value with compound interest with JavaScript

后端 未结 6 1684
悲哀的现实
悲哀的现实 2021-02-04 19:39

I\'m trying to work on a script where the user inserts a monthly income and gets the future value with compound interest after 30 years. As it is now, I\'ve assigned some values

6条回答
  •  無奈伤痛
    2021-02-04 20:14

    function FVcalc(PresentAmount,InterestRate,NumberOfYears) {
        var timescompound = 1;
        var AnnualInterestRate = (InterestRate/100)/timescompound;
        var Years= NumberOfYears
    
        var Periods=timescompound*Years;
        var NumPayments=Periods;
        var Prin=PresentAmount;
    
        MonthPayment=Math.floor((Prin)*(Math.pow((1+AnnualInterestRate),(Periods)))*100)/100;
        FVFactor=(Math.pow((1+AnnualInterestRate),(Periods)))
        return MonthPayment
    }
    

    http://www.uic.edu/classes/actg/actg500/pfvatutor.htm

提交回复
热议问题