A polynomial of a single variable x with integer coefficients is an expression of the form

where ci, i = 0, 1, …, n, are integers.
Create a class for polynomials up to the nth degree. A specification of the methods for this class is provided next:
■ public Polynomial(int maxDegree)
Constructs a new polynomial of degree maxDegree with all of the coefficients set to zero
■ public Polynomial(int[] coef)
Constructs a new polynomial with the corresponding coefficients passed in the coef array, with the highest degree as coef[0] and the constant term in coef [coef. length-1 ]. So the array (3,2, 1) creates the polynomial 3x2 + 2x + 1.
■ public int getCoefficient(int power)
Returns an integer representing the coefficient of the xPower term
■ public void setCoefficient(int coef, int power)
Sets the coefficient of the xpower term to coef
■ public String toString()
Returns the string representation of the polynomial. For example, 3x2 + 2x + 1 would be returned as 3 * x^2 + 2 * x + 1 or, more simply, 3x^2 + 2x + 1. Any term whose coefficient is zero should not appear in the string unless the polynomial has only a single constant term of zero.
■ public double evaluate(double x)
Evaluates the polynomial for the value x and returns the result p(x)
■ public static Polynomial derivative(Polynomial p)
Returns a Polynomial representing the derivative of the polynomial p
■ public double bisection(double a, double b)
throws java.lang.IllegalArgumentException
Returns a double representing the root of the Polynomial using the Bisection Method. The bisection method requires two initial points a and b such that p (x) and p(x) have opposite signs; if they do not, then java.lang.IllegalArgumentException should be thrown. Though there could be multiple roots between a and b, the method will return the first root it finds such that evaluating the polynomial at p(root) < 0.000001.
One method that can be used to easily evaluate a polynomial is based upon Horner’s rule. Note that the fourth degree polynomial 2x4 + x3 −4x2 + 3x + 5 can be evaluated as

or, in more general terms

To find the derivative of a polynomial, you simply find the derivative of each term in the polynomial. The derivative of a term
. So for example, the derivative of

To test the Polynomial class, create a second class called TestPolynomial. This class should support the following interaction with the user (user input is shaded):


We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.