小编Kha*_*nak的帖子

创建一个java程序来解决二次方程

求解二次方程

到目前为止,我已写下以下内容.我不确定如何引入第二种方法

public static void main(string args[]){

}

public static  double quadraticEquationRoot1(int a, int b, int c) (){

}

if(Math.sqrt(Math.pow(b, 2) - 4*a*c) == 0)
{
    return -b/(2*a);
} else {
    int root1, root2;
    root1 = (-b + Math.sqrt(Math.pow(b, 2) - 4*a*c)) / (2*a);
    root2 = (-b - Math.sqrt(Math.pow(b, 2) - 4*a*c)) / (2*a);
    return Math.max(root1, root2);  
}

}
Run Code Online (Sandbox Code Playgroud)

java applet computer-science

1
推荐指数
1
解决办法
4万
查看次数

标签 统计

applet ×1

computer-science ×1

java ×1