I have an assignment where I need to do some operations on polynomials (add, multiply, ...) which are represented by linked lists. Part of the assignment is to make an inner class Term containing two int fields and a constructor with coef and exp ints) I also need an inner class Node that has a term and node field, along with a constructor that also inludes term and node parameters.
I also need to have a private Node field that will represent the polynomial as a singly linked list with a head (and ordered by exponent from smallest to largest).
What I have so far is:
public class Term {
int c, x;
Node ply;
public Term (int cf, int ex){
this.c=cf;
this.x=ex;
}
}
public class Node {
Term aTerm;
Node aNode;
public Node(Term t1, Node n1){
this.aTerm=t1;
this.aNode=n1;
}
}
What else is missing from these classes and constructors? I know what I write isn't much, I'll try to revise it again soon (I just got over a fever).