/** PolynomialD2.java defines a degree 2 polynomial class. *  Author:  Joel C. Adams *  Version: For Java: An Introduction to Computing 1/e.  All Rights Reserved. *  NOTE: Polynomial terms are white-space delimited. *  Examples: 1 + 2x - 3xx, 1 +2x -3xx, 1 -2x + 3xx are all ok. */package ann.math.polynomial;import ann.util.Controller;public class PolynomialD2 extends PolynomialD1{ /** Default constructor  *  Postcondition: myA == 0.0 && myB == 0.0 && myC == 0.0.  */ public PolynomialD2() {   super();   myC = 0.0; } /** Construct from double  *  Receive:       double aValue, double bValue, double cValue.  *  Postcondition: myA == aValue && myB == bValue && myC == cValue.  */ public PolynomialD2(double aValue, double bValue, double cValue) {   super(aValue, bValue);   myC = cValue; } /** Construct from String  *  Receive:       String polyString.  *  Precondition:  strPolyD1 is of the form "a + bx + cxx" or "a + bX + cXX",  *                  where a and b are numeric values.  *  Postcondition: myA == a && myB == b && myC == c.  */ public PolynomialD2(String polyString) {   super(polyString);                 // process A, B terms (using myTokenizer)   myC = getNextCoefficient();        // process C term (same way) } /*  C-attribute accessor  *  Return: myC.  */ public double getC() {   return myC; } /* C-attribute mutator  * Receive:       double newC.  * Postcondition: myC == newC.  */ public void setC(double newC) {   myC = newC; } /** String converter (output)  *  Return: the String equivalent to me.  */ public String toString() {   if (myC < 0)     return super.toString() + " - " + Double.toString(-myC) + "xx";   else     return super.toString() + " + " + Double.toString(myC) + "xx"; }//--- Attribute variable --- private double myC;}