@Override
    public String toString(){
        PolyNode current = firstNode;
        String str = "";
        
        if(isEmpty())
            return "The polynomial is empty!";
        
        while(current != null){
            
            if(current == firstNode)
                str += current.getCoefficient();
            
            if(current != firstNode && current.getCoefficient() > 0)
                str+= " + " + current.getCoefficient();
            else if(current != firstNode && current.getCoefficient() < 0){
                str +=" - " + Math.abs(current.getCoefficient());
            }
            
            //check to see if the current variable has an exponent
            if(current.getExponent() != -1)
                str += "x";
            //check to see if the exponent is greater that one
            //if not only the variable will show otherwise
            //the exponent will be added to x
            if(current.getExponent() > 1)
                str += "^" + current.getExponent() + " ";
            current = current.getNext();
        }
        return str;  
    }