Question: One of the exercises in Chapter 3 asked you to write a method that would find the roots of a quadratic equation of the form

One of the exercises in Chapter 3 asked you to write a method that would find the roots of a quadratic equation of the form ax2 + bx + c = 0. The quadratic method was passed a , b , and c and then applied the following quadratic formula:

-b+ V – 4ac x = 2а

Under what conditions would this formula fail? Modify the quadratic method so that it will reject invalid values of a , b , or c by throwing an exception.

-b+ V 4ac x = 2

Step by Step Solution

3.35 Rating (167 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

The quadratic method would fail if the coefficient a is ... View full answer

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 Building Java Programs A Back to Basics Approach Questions!