Java语言程序设计第八版基础篇的编程练习

图片说明
为什么按照下面的运行实例的数进行输入所得的结果却不同
import java.util.Scanner;

public class FutureInvestmentValue {

public static void main(String[] args) {
    Scanner input = new Scanner(System.in);
    System.out.print("Enter investment amount:");
    double investmentAmount = input.nextDouble();
    System.out.print("Enter monthly interest rare:");
    double monthlyInvestmentRate = input.nextDouble();
    System.out.print("Enter number of years:");
    int numberOfYears = input.nextInt();
    double futureInvestmentValue = investmentAmount * Math.pow((1 + monthlyInvestmentRate), numberOfYears * 12);
    System.out.println("Accumulated value is:" + futureInvestmentValue);
}

}

自学时实现的课后习题,贴出来以便个人记录,同时若有其他思路可以交流:
1)实现代码如下:
public class Example4-18 {
  public static void main(String[] args) {
 Scanner in = new Scanner(System.in);
 System.out.println("Enter a number: ");......
答案就在这里:Java语言程序设计-基础篇-编程练习4-18
----------------------你好,人类,我是来自CSDN星球的问答机器人小C,以上是依据我对问题的理解给出的答案,如果解决了你的问题,望采纳。

不要用scaner,它会一股脑地读取,你最好用system.in.read

自己调试下,看看输入的对不对,你的公式对不对,一步一步检查。

你这书写错了吧,年利率3.25%,不能直接用3.25,要用0.0325;

而且你计算利息和本金之和为什么是幂运算呢?比如你一年利息为1000*0.0325=32.5,本金利息和为1032.5就是了

利率是需要除以100的,所以输入是0.0425