ann.math.polynomial.PolynomialD1 - defines a degree 1 polynomial class. This class extend PolynomialD0.

NOTE: Polynomial terms are white-space delimited.

Examples: 1 + 2x, 1 +2x, 1 -2x are all ok.


public class PolynomialD1 extends PolynomialD0

Default constructor

Postcondition: myB == 0.0 && myA == 0.0.


public PolynomialD1(double aValue, double bValue)

Construct from double

Receive: double aValue, double bValue.

Postcondition: myA == aValue && myB == bValue.


public PolynomialD1(String polyString)

Construct from String

Receive: String polyString.

Precondition: strPolyD1 is of the form "a + bx" or "a + bX", where a and b are numeric values.

Postcondition: myA == a && myB == b.


public double getB()

B-attribute accessor

Return: myB.


public void setB(double newB)

B-attribute mutator

Receive: double newB.

Postcondition: myB == newB.


public String toString()

String converter (output)

Return: the String equivalent to myA.


Back to the package documentation index

Back to the Introduction

Copyright 2000 by Prentice Hall. All rights reserved.