In this extension, you literally extend the Polynomial class to add some new functionality. Complete the BetterPolynomial class by writing code into the product method that takes another Polynomial as its parameter and returns a new Polynomial that is the result of multiplying the two polynomials.
- Do not copy and paste methods from Polynomial into BetterPolynomial. Because BetterPolynomial extends Polynomial, the (non-private) methods of Polynomial are already available to you.
- Keep your LinkedList private within Polynomial. Solve this extension by using the methods available to you.
- You do have access to an Iterator over the polynomial's coefficients. The method getIterator() is available for use within BetterPolynomial.
- You must test this thoroughly to receive credit for this extension. You will have to instantiate some BetterPolynomials and run tests on them. All the existing tests should now pass without any problem. You must add additional tests for product, and be sure to test its behavior thoroughly.
This extension is compatible with the parameterized-type bridge.
Remember that in computer graphics, the coordinate (0,0) is at the upper left, and y increases down the screen. Therefore, after you rescale the points, you'll need to "flip over" the graph so that it doesn't look upside down to a mathematician.