user input to create java program
<p>I've tried creating codes to solve a quadratic formula but I've only succeeded in creating it for a specific formula. Is there any way I can be providing the variables <code>a</code>, <code>b</code>, <code>c</code> by user input then the solution prints out? The program also refuses to run on command prompt but can run in eclipse. What might be the issue? </p>

<p>Here it is.</p>

<pre><code>public class Equationsolver {

    public static void main(String[] args) {
    double a, b, c;
    a = 2;
    b = 6;
    c = 4;

    double disc = Math.pow(b,2) - 4*a*c;
    double soln1 = (-b + Math.sqrt(disc)) / (2*a) ;
    double soln2 = (-b - Math.sqrt(disc)) / (2*a);
    if (disc &gt;= 0) {
        System.out.println("soln1 = " + soln1);
        System.out.println("soln2 = " + soln2);
    }else{
        System.out.println("equation has no real roots");
    }

    }

}
</code></pre>
