# Engr. 4892 Assignment 2

**Due: **0900 Thursday, May 29, 2003.
## Polynomials

A univariate polynomial is of the form

c_{d}*x*^{d} + c_{d-1}*x*^{d-1} +
... c_{1}*x* + c_{0}
where the c_{i} are the *coefficients* and d (i.e., the
highest exponent) is the *degree*. Such a polynomial can be
represented simply by the sequence of coefficients, for example the
sequence [1.2, 3.4, 5.6] could represent 5.6*x*^{2} +
3.4*x* + 1.2.
In this assignment you
are to provide an implementation (.cpp file) for the
`Polynomial`

class as declared in
assign2_polynomial.h (and documented
here). You are to implement the following
functions and operators:

`Polynomial(int d, double *coefs)`

-- constructor
`double operator() (double x) const`

-- evaluation
operator
`int degree() const`

-- return the degree
`Polynomial& operator += (const Polynomial& r)`

--
addition with assignment
`Polynomial& operator *= (const Polynomial& r)`

--
multiplication with assignment

Note that in order to compile successfully with the test code you will need
an implementation for all of the methods. If you can't submit a working
implementation for some of the methods you should submit a stub
implementation.
Be sure to include appropriate comments, including file and function header
blocks (see Assignment Policies), and to
use good style as outlined in
Programming With Style.
Submit your source code using
Web Submit.

Back to 4892 homepage
*Last modified:
Thu 2003.05.22 at 22:58 NDT
by * Dennis Peters