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).

Without the whole assignment who can tell if these are complete? But part of the joy of OO programming is that its easy to add stuff to your classes later.
Try writing a tiny test program ( public main ... method) that constructs a simple polynomial and see how well it works. (You'll want to print what you construct, so it will be useful to override the inherited public String toString() method for your classes so you can just print them easily.)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.