*This preview shows
page 1. Sign up
to
view the full content.*

COP3530C.01, Spring 2001
Assigned:
Jan. 23, 2001
S. Lang
Assignment #2
Due:
Feb 1 in class, within 10
minute of
the lecture at 11:30 am
Note:
Updated on 1/25 (in two places) in boldface letters.
You are to write a program in C++ or in Java which uses the linked list ADT of the Text as a basis to
implement a Polynomial class.
Specifically, the
non-zero terms
of a polynomial in a single variable of
integer
coefficients are arranged in descending order of the exponents, and the coefficient, exponent pair of
each term are stored in the corresponding node of the linked list.
In the Polynomial class, use two instance
variables
numTerms
and
degree
to store, respectively, the count of non-zero terms and the degree of a
polynomial object.
The Polynomial class supports the following four operations:
(1) isEqual( ): a boolean function which uses a single parameter of a polynomial object and tests if it is
equal to the polynomial object that invokes the function.
(Two polynomials are
equal
if they have
identical terms of coefficient, exponent pairs with equal values.)
(2) add( ): a function which uses a single parameter of a polynomial object and adds it to the polynomial

This is the end of the preview. Sign up
to
access the rest of the document.