// A program to test the QE interface and the QEImpl class.
// Barry Cornelius, 28th February 2000
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
public class QEImplProg
{
   public static void main(final String[] pArgs) throws IOException
   {
      final BufferedReader tKeyboard =
                    new BufferedReader(new InputStreamReader(System.in));
      System.out.print("Type in the value of a: ");
      System.out.flush();
      String tLine = tKeyboard.readLine();
      final double tA = Double.parseDouble(tLine);
      System.out.print("Type in the value of b: ");
      System.out.flush();
      tLine = tKeyboard.readLine();
      final double tB = Double.parseDouble(tLine);
      System.out.print("Type in the value of c: ");
      System.out.flush();
      tLine = tKeyboard.readLine();
      final double tC = Double.parseDouble(tLine);
      final QE tQE = new QEImpl(tA, tB, tC);
      if (tQE.isReal())
      {
         final double x1= tQE.getRoot1();
         final double x2= tQE.getRoot2();
         System.out.println("The quadratic equation is:");
         System.out.println(tQE);
         System.out.println("It has the following roots: ");
         System.out.println(x1);
         System.out.println(x2);
      }
      else
      {
         System.out.println("The quadratic equation does not have real roots");
      }
   }
}
