Question: Use Java please MyPolynomial -coefts:doublel +MyPolynomial (coeffs:double...) +getDegree():int +toString):String- +evaluate(x: double): double +add(right:MyPolynomial) :MyPolynomial A class called MyPolynomial, which models polynomials of degree-n (see equation),
Use Java please

MyPolynomial -coefts:doublel +MyPolynomial (coeffs:double...) +getDegree():int +toString):String- +evaluate(x: double): double +add(right:MyPolynomial) :MyPolynomial A class called MyPolynomial, which models polynomials of degree-n (see equation), is designed as shown in the class diagram It contains: An instance variable named coeffs, which stores the coefficients of the n-degree polynomial in a double array of size nt1, where c0 is kept at index 0 Oct. 2017 Assi t 3 of CSC 295-01 (F17 Page 3 of 3 . A constructor MyPolynomial(coeffs:double...) that takes a variable number of doubles to initialize the coeffs array, where the first argument corresponds to c0 . A method getDegree0 that returns the degree of this polynomial . A method toString0 that returns "cnx^ntcn-1x*Mn-1)+...+clx+c0". . A method evaluate(double x) that evaluate the polynomial for the given x. by substituting the given x into the polynomial expression . Methods add0 adds this polynomial with the given MyPolynomial instance another, and returns this instance that contains the result
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
