错误:类中的方法无法应用于给定类型

时间:2015-10-01 13:35:56

标签: methods

如何摆脱此错误?

它说:

required: double, double
found: no arguments
reason: actual and formal argument lists differ in length

代码:

public double computeBMI(double kg, double meter)
{
    double bmin;

    bmin= kg/(meter*meter);

    return bmin;
}

public static void main (String args[])
{
    BMI obj = new BMI();    
    double bmin = obj.computeBMI();  //error appears here the period is highlighted.
    obj.checkStatus(bmin);
}   

1 个答案:

答案 0 :(得分:0)

嗯,您的const string backToChars = to_string(num + 13.0); copy(backToChars.cbegin(), backToChars.cend(), cstring + 5); 方法需要两个computeBMI。您没有传递任何内容,请尝试在错误行的空括号中输入两个doubles。错误消息告诉您。