Question: In java, Please implement the ADT for a Polynomial. An array is used to store the different coefficients of the polynomial. The size of the

In java,

Please implement the ADT for a Polynomial.

An array is used to store the different coefficients of the polynomial. The size of the array is degree +1, where degree is the degree of the polynomial.

For example, 3x + 5x2 + 7x4 is: (below)

3

0

5

0

7

The ADT mandates the following static class operations:

zero() -> return a new polynomial p(x) = 0 isZero(poly) -> returns true if the polynomial is zero, false otherwise coeff(poly, exponent) -> return the coefficient for the given exponent or 0 if it does not exist

leadExp(poly) -> return the lead exponent of the given polynomial

remove(poly, exponent) -> Remove the corresponding term from the polynomial and return it,

otherwise return -1

add(poly1, poly2) -> return the poly that is the addition of poly1 and poly2 mult(poly1, poly2) -> return poly1 x poly2 //THIS IS PROBABLY HARDEST

In addition, polynomials should be cloneable and should implement a proper equals method and toString method

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!