Polynomial Assignment:
Please fully implement all the methods in the sequential and linked implementation for the Polynomial class.
// sequential implementation
public class Polynomial {
private static final int MAX_POWER = 100;
private int[] coeffArray = new int[MAX_POWER+1];
private int power;
public Polynomial() {…}
public Polynomial add(Polynomial rhs) {…}
public Polynomial multiply(Polynomial rhs) {…}
public void print() {…}
public void setCoefficient(int p, int coefficient) {…}
public void setPower(int n) {…}
public int getPower() {...}
public int[] getCoefficientArray(){…}
}
// linked implementation
public class Polynomial {
private LinkedList coeffs;
private static class Term {
public int coefficient;
public int exponent;
public Term(int c, int e) {
coefficient = c;
exponent = e;
}
}
public Polynomial() {…}
public Polynomial add(Polynomial rhs) {…}
public Polynomial multiply(Polynomial rhs) {…}
public void print() {…}
public void insertTerm(int coefficient, int exp) {…}
}