Question: write a java program for the following question: Design a class called MyPolynomial, which models polynomials of degree-n, like: 2-1 It contains at least: An

write a java program for the following question:

write a java program for the following question: Design a class called

MyPolynomial, which models polynomials of degree-n, like: 2-1 It contains at least:

An instance variable named coef, which stores the coeficients of the ndegree

Design a class called MyPolynomial, which models polynomials of degree-n, like: 2-1 It contains at least: An instance variable named coef, which stores the coeficients of the ndegree polynomialin an int array of size M, where co is kept at index 0, and M is a constant (100) An instance variable deg (for the degree n) . A constructor Mypolynomial intl) coeffs) that takes an array of doubles, where the first argument corresponds to co, and generates a new instance with the given values A method evaluate(double x) that evaluates the polynomial for the given x, by substituting the given x into the polynomial expression. A method multiply(MyPolynomial p) that multiplies the polynomial with the given MyPolynomial argument, and returns a new instance that contains the result of the multiplication A method toString() that overwrites the standard printing. This allows you to use the polynomial p1 in the println statement, as in TestMyPolynomial. The first line of toString is given

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!