Question: Java Program In this lab, you will construct a class called QuadraticSolver that will compute the real roots of a quadratic function (f(x) =ax^2 +

Java Program

In this lab, you will construct a class called QuadraticSolver that will compute the real roots of a quadratic function (f(x) =ax^2 + bx +c ).

The class will implement the following methods:

A default constructor that initializes a legitimate quadratic function.

An overloaded constructor that takes the values of a, b, and c in the function f(x) = ax^2 + bx

+c . This method throws a QuadraticException in the case where the input does not

define a quadratic function.

A method that computes the discriminant ( b^2 - 4ac).

Boolean methods determining whether the solutions of the quadratic equation ax^2+ bx +c =

0 have real or non-real solutions.

Two methods, one for each real root of the equation ax^2+bx + c = 0. Each method will throw

a NonRealException when the root is a non-real value.

A toString method that (reasonably) prints the quadratic function.

The classes QuadraticException and NonRealException have been provided. Implement a main method in a separate class to test your implementation.

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!