Question: Write Java program The solution for a quadratic equation of the form a x 2 + b x + c = 0 is given as

Write Java program
The solution for a quadratic equation of the form ax2+bx+c=0 is given as
x1=-b+b2-4ac22a,x2=-b-b2-4ac22a
This equation will have solutions only if b2-4ac0.0. Write a Java program that computes the
values of x1 and x2, given the values of a,b and c.
Programming requirements
You must read the values of a,b and c(declared as double) from the input, and compute x1
and x2(declared as double). Make sure that the values for a,b and c are chosen in such
a way that b2-4ac0.0. Otherwise, you will not have an answer.
You must print all the values -a,b,c,x1 and x2 with appropriate captions.
To cross check your answers, use a=1.0,b=2.0 and c=1.0. You should get x1=-1.0 and
x2=-1.0.
Hint: To compute the square root, use Math. b**b-4**a**c2.Write
 Write Java program The solution for a quadratic equation of the

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!