创建jquery复合计算器

create jquery compound calculator

本文关键字:计算器 复合 jquery 创建      更新时间:2023-09-26

下面提到的计算器使用的是哪种公式

https://www.lifeclub.com/public/calculator.aspx

我正在尝试使用jquery创建一个类似的计算器。我很难把配方弄对。

表格上的利息是如何计算的。公式

是什么?我已经试过了。但我的数据和他们的不一样http://jsbin.com/oxerez/edit javascript、html、生活

总投资为初始投资和每月额外投资。

赚取的总利息是每月计算1%的利息,并将其加到总数中,再减去1%,以此类推。

平均月收益是所有利息加起来除以月数,1年12,2年24,以此类推。

总余额是总投资和总利息收入的总和。

var initial_investment = 100,
    additional_monthly_invest = 0,
    interest_rate = 1,
    terms_of_investment = 1,
    total_invested = initial_investment,
    interest_earned = 0,
    total_interest_earned,
    average_month_return,
    total_balance,
    i = terms_of_investment * 12 + 1;
while ( i -= 1 ) { // optimisation habit I've gotten into
    interest_earned += ( ( ( total_invested + interest_earned ) / 100 ) * interest_rate );
    total_invested += additional_monthly_invest;
}
average_month_return = interest_earned / ( terms_of_investment * 12 );
total_balance = total_invested + interest_earned;

Update:修复代码。我忘了把一些变量加到利息里。现在工作。