# Assignment VI

**Due date**Dec. 8, 2004.

We want to manipulate polynomials in C++. A polynomial is a sequence of terms. a term is a pair (exponent, coefficient) where the exponent is a non-negative integer and the coefficient is a double-precision number. For example, we want to handle the polynomial:

5.3 x^3 – 1.2 x + 123.5

a) Write a class definition for a term. A single constructor is sufficient.

b) Write a class definition for a polynomial. Given that polynomials have an arbitrary size, the proper implementation is by means of a linked list, i.e. each term has a pointer to the next term.

c) Write a constructor for a polynomial, whose input is a term.

d) Write operators that add a term to a polynomial, and that multiply a term and a polynomial.

e) Write an operator that adds two polynomials.

f) Write a destructor for the polynomial class.

g) Write an output routine for polynomials, overloading the << operator. Assume that the name of the variable is X.

Test your code using any C++ compiler.You can:

Use g++ on omicron or any other unix machine at NYU, or

use Borland C++ on a machine in one of the PC labs, or

use gcc for your Windows95/98/NT/2000 or Linux machine at home.

Click here to order this paper @Superbwriters.com. The Ultimate Custom Paper Writing Service