title: Quadratic Equation (handle exceptions) for illegal inputs
body: <p>I am trying to create a program that asks users for input values for variables in the quadratic equation. I want the code to deal with bad input with the use of exception handling. Bad input would be: non-numeric values where numeric values are excepted. Where i am running into a problem is when a bad value is entered instead of terminating the program i want the code to re request an input. So, in cases where Non-numeric, A=0 or B and C both = 0.
  The code below has some errors but I was wondering if someone could help me crack this one! Thanks alot</p>
  
  <pre><code>import java.util.InputMismatchException;
  import java.util.Scanner;
  //Program that does quadratic equations with exceptions
  
  public class Quadratic{
      public static void main(String[] args){
          Scanner sc = new Scanner(System.in);
          double a ; 
          do{
              try{ 
                  System.out.print("Enter a value for 'a': ");
                  a =sc.nextDouble(); 
              }                 
              catch (InputMismatchException ex)
              {
                  System.out.println("not a valid character..");
                  System.out.println("please try again:");
                  sc.nextDouble(); //prompt user again
              }
          }while (a==0);
          System.out.println("value can not be equal to 0. Please enter another value:\n");
          a= sc.nextDouble();
      }
  }
  </code></pre>