a006.
一元二次方程式
| From: [210.66.168.33] |
發表日期
:
2011-04-19 00:44
package code;
import java.util.Scanner;
public class a006{
private int a,b,c;
public static void main(String[] args) {
a006 A=new a006();
Scanner scan =new Scanner(System.in);
A.a=scan.nextInt();
A.b=scan.nextInt();
A.c=scan.nextInt();
A.aJudge(A.a);
A.Judge(A.a,A.b,A.c);
}
public void Judge(int a,int b,int c){
int root1,root2;
double judge=(Math.pow(b,2)-(4*a*c));
if(judge>0){
root1=(int)(-b+Math.sqrt(judge))/(2*a);
root2=(int)(-b-Math.sqrt(judge))/(2*a);
System.out.println("Two different roots x1="+root1+",x2="+root2);
}else if(judge==0){
root1=-b/(2*a);
System.out.println("Two same roots x="+root1);
}else{
System.out.println("No real root");
}
}
public void aJudge(int a){
if(a<0){
this.a=-a;
b=-b;
c=-c;
}
}
}
--------------------------------------------------下面是錯誤訊息
本題目共 5 個測試點,您沒有通過任何一個測試點。(score:0)
錯誤訊息如下:
編譯錯誤, 請檢查語法是否符合系統所支援的編譯器的要求。
錯誤訊息:
/tmp/code_780462.java:11: cannot find symbol
symbol : class Mathx
location: class code_780462
Mathx A=new Mathx();
^
/tmp/code_780462.java:11: cannot find symbol
symbol : class Mathx
location: class code_780462
Mathx A=new Mathx();
^
2 errors