Instructions:
anxn + an-1xn-1+ ... + a1x + a0,
where n is a non-negative integer, ak (k = 0.. n) are numbers, and an is a number not equal to 0.
n is called the degree of p(x),ak (k = 0.. n) are called the coefficients of p(x), and an is called the leading coefficient of p(x).
For examples:
We can describe polynomials in the following manner. A polynomial can be constant or non-constant; if it is constant, it has a leading coefficient and degree 0; if is not constant, it has a leading coefficient, a non-zero degree, and a lower degree polynomial. The polynomial intrinsic behavior is to provide the clients with its degree, its leading coefficient, and its lower degree polynomial (if any).
Your task is to design a system of classes to implement polynomials in the most flexible way. For the sake of simplicity, we shall consider polynomials with integer (int) coefficients only. Your polynomial implementation must provide ways to
Your polynomial system must be designed in such a way that, adding at a later time the capability to multiply polynomials, perform long division on polynomials, etc. will only require adding new classes to the system and not any modification and recompilation of the existing code. Also, suppose at a later time you come up with a better algorithm to evaluate a polynomial, your system should allow you to replace the old evaluation algorithm with the new one without any modification and recompilation of the existing code. Explain and describe briefly your design in terms of well-known patterns. Write appropriate test code. 30 points