Question: For this program you are going to create a class that helps to solve the quadratic equation. The equation has the following form: ax 2

For this program you are going to create a class that helps to solve the quadratic equation. The equation has the following form:

ax2 + bx + c = 0

The roots of the equation are:

x1 = -b + sqrt(b2 - 4 * a * c) and x2 = -b - sqrt(b2 - 4 * a * c)

The phrase in the parenthesis is called the discriminant. If the value of the discriminant is positive, the equation has two roots. If it is zero, the equation has one root. If it is negative, the equation has no roots.

Create a class named Quadratic that finds the roots of a quadratic equation when the coefficients a, b, and c are given.

Hint: You should create three individual coefficient private members.

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!