I am writing a polynomial class that later I will use to add two polynomials together. Right now I am working on writing the compareTo method (my class implements Comparable). Unfortunately I am getting the following error:
[CODE=JAVA]Polynomial.java :79: cannot find symbol
symbol : variable degree
location: class java.lang.Objec t
if (this.degree == ob1.degree)
^
Polynomial.java :81: cannot find symbol
symbol : variable degree
location: class java.lang.Objec t
else if (this.degree > ob1.degree)
[/CODE]
here is my compareTo method:
[CODE=JAVA]public int compareTo(Objec t ob1)
{
if (this.degree == ob1.degree)
return 0;
else if (this.degree > ob1.degree)
return 1;
else
return -1;
}[/CODE]
I have a feeling that my error will be something simple. Thanks in advance for any help!
[CODE=JAVA]Polynomial.java :79: cannot find symbol
symbol : variable degree
location: class java.lang.Objec t
if (this.degree == ob1.degree)
^
Polynomial.java :81: cannot find symbol
symbol : variable degree
location: class java.lang.Objec t
else if (this.degree > ob1.degree)
[/CODE]
here is my compareTo method:
[CODE=JAVA]public int compareTo(Objec t ob1)
{
if (this.degree == ob1.degree)
return 0;
else if (this.degree > ob1.degree)
return 1;
else
return -1;
}[/CODE]
I have a feeling that my error will be something simple. Thanks in advance for any help!
Comment