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.
The purpose of this extension is to graph polynomials within NIP. More
specifically, Write a main method in Polynomial.java that
creates a NIP window with several panels and displays several
different functions in various panels by sampling the polynomial.
Draw tiny circles for the points and draw lines to connect them. If
you want to really impress us, create sliders for the coefficients of
the polynomical and update the graph of the function as the user moves
the slider. You should draw the X and Y axis on the graph, with tick marks (or a grid). Use the nip.Text class to label the tick marks (or grid)
on each axis at regular intervals.
If the the origin (0,0) is not part of the region that
you are graphing, you can show the two axes as perpendicular
non-intersecting line segments.
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.