## BJP3 Exercise 3.8: quadratic

Language/Type: Java Math method basics parameters
Author: Whitaker Brand (on 2013/04/01)

Write a method called `quadratic` that solves quadratic equations and prints their roots. Recall that a quadratic equation is a polynomial equation in terms of a variable x of the form a x2 + b x + c = 0. The formula for solving a quadratic equation is:

Here are some example equations and their roots:

equation call x2 - 7x + 12 x2 + 3x + 2 `quadratic(1, -7, 12);` `quadratic(1, 3, 2);` ```First root = 4.0 Second root = 3.0 ``` ```First root = -1.0 Second root = -2.0 ```

Your method should accept the coefficients a, b, and c as parameters and should print the roots of the equation. You may assume that the equation has two real roots, though mathematically this is not always the case.

Also, there should be two roots, one the result of the addition, the other, the result of the subtraction. Print the root resulting from the addition first.

Type your solution here:

This is a method problem. Write a Java method as described. Do not write a complete program or class; just the method(s) above.

You must log in before you can solve this problem.

If you do not understand how to solve a problem or why your solution doesn't work, please contact your TA or instructor.
If something seems wrong with the site (errors, slow performance, incorrect problems/tests, etc.), please

Is there a problem? Contact a site administrator.