參數ab及c從命令行做參數輸入java?
private static X fx (int a,int b,int c) throws Exception{
X x = new X();
double m = b*b - 4*a*c;
if(m>=0){
x.x1=(-1*b+Math.sqrt(m))/(2*a);
x.x2=(-1*b-Math.sqrt(m))/(2*a);
return x;
}
else throw new Exception("無解");
}
參數ab及c從命令行做參數輸入java?
private static X fx (int a,int b,int c) throws Exception{
X x = new X();
double m = b*b - 4*a*c;
if(m>=0){
x.x1=(-1*b+Math.sqrt(m))/(2*a);
x.x2=(-1*b-Math.sqrt(m))/(2*a);
return x;
}
else throw new Exception("無解");
}