This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class QuadraticSolver { | |
public static final int RESULT_BAD = 0; | |
public static final int RESULT_ONE = 1; | |
public static final int RESULT_TWO = 2; | |
public static final Result solve(double a, double b, double c) { | |
double d = b * b - 4 * a * c; | |
if (d < 0) | |
return new Result(RESULT_BAD, 0, 0); | |
double sqd = Math.sqrt(d); |