Question: Write Java code ( Algebra: solve quadratic equations ) The two roots of a quadratic equation a x 2 + b x + c =
Write Java code
Algebra: solve quadratic equations
The two roots of a quadratic equation can be obtained using the following formula:
is called the discriminant of the quadratic equation. If it is positive, the equation has two real roots. If it is zero, the equation has one root. If it is negative, the equation has no real roots.
Write a program that prompts the user to enter values for and and displays the result based on the discriminant. If the discriminant is positive, display two roots. If the discriminant is
display one root. Otherwise, display "The equation has no real roots".
Note that you can use pow to compute
Sample Run
Enter :
The roots are and
Sample Run
Enter :
The root is
Sample Run
Enter a b c:
The equation has no real roots
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
