显式转换中的未知错误:java

显式转换中的未知错误:java,java,compiler-errors,Java,Compiler Errors,我对这个代码有问题,我不知道为什么,有人能帮我吗?我正在尝试重构我的主方法,由于这个错误,我的ide不允许我重构。错误在第24行,我已经用注释标记了它。根据请求,我已经包含了错误消息和计算余额方法。 导入java.text.NumberFormat; 导入java.util.Scanner; 公共班机{ 年内最后静态整数月=12; 最终静态整数百分比=100; 公共静态void main(字符串[]args){ int principal=(int)readNumber(“principal:

我对这个代码有问题,我不知道为什么,有人能帮我吗?我正在尝试重构我的主方法,由于这个错误,我的ide不允许我重构。错误在第24行,我已经用注释标记了它。根据请求,我已经包含了错误消息和计算余额方法。

导入java.text.NumberFormat;
导入java.util.Scanner;
公共班机{
年内最后静态整数月=12;
最终静态整数百分比=100;
公共静态void main(字符串[]args){
int principal=(int)readNumber(“principal:”,1000,1_000_000);
双倍年利率=(双倍)readNumber(“年利率:”,1,30);
字节年份=(字节)读取编号(“期间(年份):”,1,30);
打印抵押(本金、年利息、年);
System.out.println(“付款计划”);
System.out.println(“------------------”);
对于(短月=1;月<年*年中的月;月++){
双倍余额=计算平衡(本金、年利息、年、月);//此处错误
System.out.println(NumberFormat.getCurrencyInstance().format(balance));
}
}
私人静态无效打印抵押(整数本金,双年度利息,字节年){
双重抵押=计算抵押(本金、年利息、年);
字符串mortgagecomputed=NumberFormat.getCurrencyInstance().format(抵押);
系统输出打印号(“抵押”);
System.out.println(“--------------------------”;
System.out.println(“每月付款:+抵押计算”);
}
公共静态双读编号(字符串提示、双最小值、双最大值){
扫描仪=新的扫描仪(System.in);
双重价值;
while(true){
System.out.println(提示);
value=scanner.nextDouble();//更改为浮点,不需要那么多内存
如果以下代码中的((值>=min)和((值)

public static double calculateBalance (
        int principal,
        double mortgage,
        double annualInterest,
        byte years,
        short numberOfPaymentsMade ){

    double monthlyInterest = annualInterest / (Percent * Months_In_Year);
    double numberOfPayments = years * Months_In_Year;
    double balance =(double) principal *
            (Math.pow(1 + monthlyInterest, numberOfPayments) - Math.pow(1 + monthlyInterest, numberOfPayments)
            / (Math.pow(1 + monthlyInterest, numberOfPayments) - 1));
                    return balance;

    }
}
取消双重抵押,因为我们不需要。因此,最终ans:-

public static double calculateBalance (
        int principal,
        double annualInterest,
        byte years,
        short numberOfPaymentsMade ){

    double monthlyInterest = annualInterest / (Percent * Months_In_Year);
    double numberOfPayments = years * Months_In_Year;
    double balance =(double) principal *
            (Math.pow(1 + monthlyInterest, numberOfPayments) - Math.pow(1 + monthlyInterest, numberOfPayments)
            / (Math.pow(1 + monthlyInterest, numberOfPayments) - 1));
                    return balance;

    }
}

错误是什么,您是否编写了
calculateBalance
方法?它在哪里?
calculateMortgage
同样不可见。请同时发布原始错误消息(也可能是屏幕截图).
calculateBalance
将一个
双重抵押贷款
作为第二个参数。您没有传递任何内容。什么部分让您感到困惑?您有一个需要5个参数的方法,您只传递4个参数。这与“显式转换”无关。错误消息完美地说明了问题。
public static double calculateBalance (
        int principal,
        double annualInterest,
        byte years,
        short numberOfPaymentsMade ){

    double monthlyInterest = annualInterest / (Percent * Months_In_Year);
    double numberOfPayments = years * Months_In_Year;
    double balance =(double) principal *
            (Math.pow(1 + monthlyInterest, numberOfPayments) - Math.pow(1 + monthlyInterest, numberOfPayments)
            / (Math.pow(1 + monthlyInterest, numberOfPayments) - 1));
                    return balance;

    }
}