Question: Write a Java program named Quadratic that solves quadratic equations. The program will take input from the user for the coefficients of a quadratic equation
Write a Java program named Quadratic that solves quadratic equations. The program will take input from the user for the coefficients of a quadratic equation ax bx c and determine the nature of the roots real imaginary, or equal using a decision structure.
If the discriminant is greater than zero, print the two distinct real roots.
If the discriminant is equal to zero, print the single real root.
If the discriminant is less than zero, print that the roots are imaginary.
Use DecimalFormat to get decimal max in your output.
Run #
Quadratic Equation Solver
Enter the value of a:
Enter the value of b:
Enter the value of c:
Roots of the quadratic equation:
Distinct Real Roots:
Root :
Root :
Run #
Quadratic Equation Solver
Enter the value of a:
Enter the value of b:
Enter the value of c:
Roots of the quadratic equation:
Imaginary Roots
Run #
Quadratic Equation Solver
Enter the value of a:
Enter the value of b:
Enter the value of c:
Roots of the quadratic equation:
Single Real Root:
Root:
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
