add an If Else statement and......uh????

the Task:

Write a ConsoleProgram that accepts values for a, b, and c, and then calculates the two quadratic equation solutions.

If the quantity under the square root sign is negative, the equation has no real solutions, and your program should display a message to that effect.

here is my code:

Code:

`public void run(){`

println("Enter coefficients for the quadratic equation: ");

int a = readInt(" Input a: ");

int b = readInt(" Input b: ");

int c = readInt(" Input c: ");

[COLOR="SeaGreen"]//if ((b*=b)-(4*a*c)<=0){

//println(" The formula has no real solutions");

//}else{[/COLOR]

println(" The first solution is: "+ quadraticPlus(a,b,c));

println(" The second solution is: "+ quadraticMinus(a,b,c));

[COLOR="SeaGreen"] // } [/COLOR]

}

private double quadraticMinus(int a, int b, int c) {

double minusX = (-b - Math.sqrt((b*=b)-(4*a*c)))/2*a;

return minusX;

}

private double quadraticPlus(int a, int b, int c) {

double plusX = (-b + Math.sqrt((b*=b)-(4*a*c)))/2*a;

return plusX;

}

}

i wrote this without the If Else statement (in green) to make sure the methods worked, which they did

and heres my output

Code:

` Input a: 1`

Input b: -5

Input c: 6

The first solution is: 3.0

The second solution is: 2.0

this output is correct.

but, when i add in the If Else statement i get this output

Code:

`Input a: 1`

Input b: -5

Input c: 6

The first solution is: -0.24234932786873742

The second solution is: -24.757650672131263

and i dont understand why it has changed. :confused:

if the method is passed the same values why should it return different results