Math.pow难度

Doe*_*ter 1 java pow

当我为月利率和1年投资金额4.25输入1000时,为什么我得到的结果是4.384414858452464E11而不是预期的1043.34?

import java.util.Scanner;

public class FinancialApplicationFutureInvestment_13 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.println("Enter investment amount: ");
        int investmentAmount = input.nextInt();
        System.out.println("Enter monthly interest rate: ");
        double monthlyInterestRate = input.nextDouble();
        System.out.println("Enter number of years");
        int numOfYears = input.nextInt();

        double futureInvestmentValue = investmentAmount *
            (Math.pow(1 + monthlyInterestRate, numOfYears * 12));
        System.out.println("Accumulated value is: " + futureInvestmentValue);

        double test = Math.pow(1 + monthlyInterestRate, numOfYears * 12);
        System.out.println(test);
    }
}
Run Code Online (Sandbox Code Playgroud)

Ivo*_*ops 5

每月利率可能需要输入0.0425