It was working on bits and pieces of it and have the code in jumbles. I can fix it but I'm going to just add it as is to make it easier to add.

Polynomial Polynomial::operator + (const Polynomial& poly, const Polynomial& poly2) const { Polynomial poly3; if (poly.list.get(0).getExponent() == poly2.list.get(0).getExponent()) poly3.list.addFirst(Term((poly.list.get(0).getCoefficient() + poly2.list.get(0).getCoefficient()), poly.list.get(0).getExponent())); } // the overloaded () method replaces all variables in polynomial with f and evaluates them and returns the answer float Polynomial::operator () (float f) { if (list.empty()) return 0; float answer; for(int i = 0; i < list.Size(); i++) { answer = answer + (list.get(i).getCoefficient() * pow(f, list.get(i).getExponent())); } return answer; }

Term Term::derivative() { if (getExponent() == 0) return Term(0.0f, 1); else return Term((getCoefficient() * getExponent()), (getExponent()-1)); } Polynomial Polynomial::derivative() { Polynomial poly; for (int i = 0; i < Size(); i++) { poly.list.add(list.get(i).derivative(), i); } return poly; }

#ifndef DOUBLY_LINKED_LIST_H #define DOUBLY_LINKED_LIST_H template <class T> class DoublyLinkedList { class Node { friend class DoublyLInkedList; private: T data; Node *next; Node *previous; public: Node(const T& data, Node *next, Node *previous); T getData(); T* getDataPointer(); void setData(const T& data); inline Node *getNext() { return next; } inline Node *getPrevious() { return previous; } Node<T> getPrevious() const; void setNext(Node<T> next); void setPrevious(Node<T> previous); }; private: unsigned int size; Node *head; Node *tail; public: DoublyLinkedList(); ~DoublyLinkedList(); void add(unsigned int index, const T data); void addFirst(const T& data); void addLast(const T& data); T get(unsigned int index) const; T getFirst() const; T getLast() const; void remove(unsigned int index); void removeFirst(); void removeLast(); unsigned int Size(); bool isEmpty(); string toString(); int find(const T& data); }; #endif

#ifndef POLYNOMIAL_H #define POLYNOMIAL_H #include "DoublyLinkedList.h" #include "Term.h" class Polynomial { public: Polynomial(); Polynomial(float[] arr, int degree); Polynomial(const Polynomial& poly); ~Polynomial(); Polynomial operator +(const Polynomial& poly1, const Polynomial& poly2) const; Polynomial operator * (const Polynomial& poly1, const Polynomial& poly2) const; float operator () (float f); Polynomial operator = (const Polynomial& poly) const; Polynomial derivative() const; string toString(); private: DoublyLinkedList<Term(float, int)> list(); // is this legal? float *array; }; #endif

#include <iostream> #include "Polynomial.h" #include "Term.h" #include "DoublyLinkedList.h" using namespace std; Polynomial::Polynomial() { } Polynomial::Polynomial(float *array, int degree) { } Polynomial::Polynomial(const Polynomial& poly) { } Polynomial::~Polynomial() { delete[] array; } Polynomial Polynomial::operator = (const Polynomial& poly) const { } Polynomial Polynomial::operator +(const Polynomial& poly, const Polynomial& poly2) const { } Polynomial Polynomial::operator *(const Polynomial& poly, const Polynomial& poly2) const { } float Polynomial:: operator () () { } Polynomial Polynomial::derivative() const { } Polynomial Polynomial::operator = (const Polynomial& poly) const { } string Polynomial::toString() { }

#include "Term.h" #include<iostream> using namesspace std; Term::Term(float coefficient, int power) { setCoefficient(coefficient); setPower(power); } void Term::setCoefficient(float coefficient) { this -> coefficent = coefficient; } float Term::getCoefficient() const { return coefficient; } void Term::setPower(int power) { this ->power = power; } int Term::getPower() const { return power; }

#ifndef _TERM_H_ #define _TERM_H_ class Term { public: Term(float coefficient, int power); void setCoefficient(float coefficient); float getCoefficient() const; void setPower(int power); int getPower() const; private: float coefficient; int power; }; #endif