Question: Lab Exercise 04.2 Quadratic Equation Solver PLEASE USE JAVA Design a class called QuadraticEquation which will contain a quadratic equation in standard form, . Actually

Lab Exercise 04.2

Quadratic Equation Solver

PLEASE USE JAVA

Design a class called QuadraticEquation which will contain a quadratic equation in standard form, . Actually it will contain only the coefficients a, b and c. The class contains:

Private data fields a, b and c that represent the three coefficients.

A constructor method with arguments for a, b and c.

Three get methods for a, b and c. Dont forget to validate the input.

A method named getDiscriminant() that returns the discriminant which is ).

Two methods named getRoot1() and getRoot2() which return the two roots of the equation.

Root1 = and root2 =

These methods are useful only if the discriminant is not negative.

If the discriminant is

positive, there are two real roots.

zero, the two roots are identical.

negative, display No real roots.

Testing: You will test with any combination of valid values for a, b and c that you wish. Additionally you will test with non-numeric values and values that result in both identical roots and no roots. Remember that EVERY quadratic equation with real roots has TWO of them, even when they have identical values. In the case of identical values, you must display both roots.

When the user runs the program they should be prompted to input values for a, b, and c.

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!