Question: JAVA Please Help. I need help with evaluate() and Polynomial(int[] c) been trying to get solutions for days no luck. I posted a picture of
JAVA
Please Help. I need help with evaluate() and Polynomial(int[] c) been trying to get solutions for days no luck. I posted a picture of how the outcome should be. Thanks in advance.
![JAVA Please Help. I need help with evaluate() and Polynomial(int[] c) been](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f3b97dc0a51_76566f3b97d60727.jpg)


public class Polynomial private int coefficients; the constructor creates a Polynomial with the specified coefficients (passed as the parameter c) It should set the coefficients instance variable to be an array which is a copy of c At the end, the constructor calls the "simplify" method, which makes sure that the first coefficient(s) of the polymonial are non-zero. public Polynomial(int[ c) coefficients new int length] complete this make sure that the first coefficient of the polynomial is not e simplify(); simplify should (if necessary) create a new array to be stored in the coefficients instance variable In the new array, the first coefficient will be nonzero. For example, int coeffs fe, e, 2, 1, Polynomial p new Polynomial (coeffs) p represents the function f(n) en 4 en 3 2n 2 n. We would like to get ride of the highest order term (s) with coefficient of 0. In this example after calling p. simplify() p's coefficients should be 12, 1, 01, which represents f(n) 2n 2 n public void simplify() int i; for (i e; i coefficients length && coefficients[ i++) fill in the code for this method System.out.println(coefficients); int[ newCoeff new int[coefficients.length i]; for (int j j newcoeff.length; j++){
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
