新手求问关于判断的问题
package qiugengongshi;public class Root {
private double a,b,c,derta;
public double getFirstA(){
return a;}
public void setFirstA(double a){
this.a=a;
}
public double getSecondB(){
return b;}
public void setSecondB(double b){
this.b=b;}
public double getThirdC(){
return c;}
public void setThirdC(double c){
this.c=c;}
//怎么在这写一个判断derta的值,并且返回给Main类
public double calculateRoot1(double a,double b, double c){
return (-b+Math.sqrt(b*b-4*a*c))/(2*a);}
public double calculateRoot2(double a,double b ,double c){
return (-b-Math.sqrt(b*b-4*a*c))/(2*a);
}
}