/* A Quadratic is a Polynomial */
class Quadratic extends Polynomial{

  /* A Quadratic is  ax^2 + bx + c */
  public Quadratic(double a, double b, double c){
    super(new double[]{c, b, a});
  }
  
  /* =the real roots of this Quadratic if they.  Return null\
   * if the roots are complex
   */
  public double[] getRoots(){
    double a = coeffs[2], b = coeffs[1], c = coeffs[0];
    double d = b * b - 4 * a * c;
    if(d < 0)
      return null;
    if(d == 0)
      return new double[]{-b/(2*a)};
    return new double[]{(-b-Math.sqrt(d))/(2*a), (-b+Math.sqrt(d))/(2*a)};
  }
}
