advanced placement computer science
linked lists and polynomials
[inheritance]

due:  TBA

Create an class called Polynomial so that you can represent polynomials with real coefficients. Design a class Term with a real coefficient and an integer exponent to represent a term in a polynomial. Represent a polynomial as a LinkedList  using the LinkedList class in the Java API. Your Polynomial class will extend the LinkedList class.
source file: polynomial.java

For example, the polynomial 3.5x6 – 2.3x + 7 would be represented by a list with three nodes having the values:

polynomial implemented as a LinkedList

Provide a method that constructs a polynomial from input values.  Also provide the following operations/methods in your Polynomial class:

Display the resulting polynomial in a format like:
3.5x^6 – 2.3x + 7

Your test class GUI should provide textFields for the two polynomilas as well as for the solution, and buttons for the above operations. Use type double for the coefficients.

Formatting output:
public String configOutput(String poly)
{

String output = "<html>";
Scanner chopper = new Scanner(poly);

while(chopper.hasNext())
{

String temp = (String)chopper.next();
temp=temp + " ";
int index = temp.indexOf("^");

if(index >=0)
{

temp = temp.replaceAll("\\^","<sup>") + "</sup>";

}

output += temp;

}

output+="</html>";
return output;

}

XTRA credit: +10%
Display your polynomial in descending order by exponent.