Hi! I am really new to
JAVA and am trying to figure out how to make it work.
I am trying to write a basic java program for a quadratic equation where b2 – 4ac is the discriminant being tested for.
I would like the program to prompt the user to enter values for a, b, and c and displays the result based on the discriminant. I’m trying to make it so that if the discriminant is positive, two roots will be displayed, and if the discriminant is 0, one root is displayed. Otherwise, I want it to display “The equation has no real roots”.
I heard that using Math.pow(x, 0.5) to compute the square root of x would work the best.
Would very much appreciate some examples or help!
Thank you!