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 (ax2+ bx + c=0) 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 1 decimal max in your output.
Run #1
Quadratic Equation Solver
Enter the value of a: 1
Enter the value of b: 8
Enter the value of c: 12
Roots of the quadratic equation:
Distinct Real Roots:
Root 1: -2.0
Root 2: -6.0
Run #2
Quadratic Equation Solver
Enter the value of a: 1.5
Enter the value of b: 3.8
Enter the value of c: 12
Roots of the quadratic equation:
Imaginary Roots
Run #3
Quadratic Equation Solver
Enter the value of a: 4
Enter the value of b: -12
Enter the value of c: 9
Roots of the quadratic equation:
Single Real Root:
Root: 1.5

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!