I'm trying to calculate the power of a double
to calculate the Quadratic Formula
Here is the code:
private Scanner sc;
double a, b, c;
// Input Coefficients
public void InputCoeff() {
sc = new Scanner(System.in);
System.out.println("Please enter the coefficients of this quadratic equation.");
System.out.println("'ax2 + bx + c = 0'");
System.out.print("a = ");
a = sc.nextDouble();
if(a == 0){
System.out.println("Coefficient of x2 ('a') can't be zero.");
System.out.println("Otherwise, it'll be a linear funciton.");
}
System.out.print("b = ");
b = sc.nextDouble();
System.out.print("c = ");
c = sc.nextDouble();
}
public void SqRt(double x, double y, double z) {
double sqrt;
sqrt = pow(y, 2) - (4 * x * z); // This generates an error
System.out.println();
}
Why this error?
Thanks.