[Solved] Testing a quadratic equation


Not sure what trouble you’re having. I wrote:

public class Quad
{
    public static void main(String[] args) {
        double a = Double.parseDouble(args[0]);
        double b = Double.parseDouble(args[1]);

        System.out.println(Math.abs(b/a - 200.0));

        if (Math.abs(b/a - 200.0) < 1.0e-4) {
            System.out.println("first one");
        }
        else {
            System.out.println("second one");
        }
    }
}

And some output:

animato:~/src/Java/SO$ java Quad 1 200
0.0
first one
animato:~/src/Java/SO$ java Quad 2 400
0.0
first one
animato:~/src/Java/SO$ java Quad -3 -600
0.0
first one

1

solved Testing a quadratic equation