【发布时间】:2016-05-20 04:35:08
【问题描述】:
public double futureInvestmentValue(int years) {
DecimalFormat dfWithTwoDecimalPlaces;
dfWithTwoDecimalPlaces = new DecimalFormat("0.00");
double futureInvestmentValue = deposit * Math.pow((1 + (AnnualInterestRate / 12)), years * 12);
return dfWithTwoDecimalPlaces.format(futureInvestmentValue);
我收到的错误与最后一行有关。它说:“类型不匹配:无法从字符串转换为双精度” 它要求我更改为公共字符串。
谢谢!
【问题讨论】: