## CSE 131 Module 6: Abstract Data Types

### Bridges

## ADTs and Class Hierarchies

### Paramterized-Type Polynomials

Some preliminary reading may help with this extension:

Make `Polynomial` a paramterized type `Polynomial<T>`, so that you could have
a `Polynomial` of `Double`s, `Vector`s, etc.

- Think about the functions that type
`T` must be able to perform.
A good place to investigate this is in the `evaluate` method. In the
lab, what operations are performed on the contents
of a polynomial using the parameter
supplied to `evaluate`?
The parameter to `evaluate` is currently
a `double`, but you are about to generalize it
a type `T`.
- The paramter type
`T` must be *bounded* so that it can perform
the necessary operations. To accomplish this, you must:
- Define an interface that has the properties (methods) you need
`T` to
provide.
- Specify
`T` as a *bounded type*.
- Revise objects like
`Vector` and `Point` so that they
implement the interface you have defined.

- Test your
`Polynomial<T>` implementation on a variety of types, including
`Double` and `Vector`.
- As an example of your parameterized
`Polynomial`, create a polynomial
of `Vector`
that represents the displacement of a projectile fired into the air and subjected
to gravity.
- The acceleration due to gravity is a
`Vector`, and so is the initial
velocity for the projectile.
- The polynomial's free variable (
`x` in the
lab) represents time as well
as the horizontal coordinate of the projectile.
- Evaluate the
polynomial over a sequence of
`x`-values to show the projectile's
vertical coordinate over time.

This bridge is compatiable with the `BetterPolynomial` extension.