//计算接下来的年份
for(int i = 1; i < balances.length ;i++)
{
for(int j = 0;j < balances[i].length; j++)
{
//获取本金结余
double oldBalance = balances[i-1][j];
//计算interest 本金*利率
double interest = oldBalance * interestRate[j];
// 计算下一年本金
balances[i][j] = interest + oldBalance;
}
}
网友评论