What Was Added
QuadraticDriver upgrades:
SHOULD_SHOW_BREADCRUMBSstatic boolean — toggle all debug output with one lineDFDecimalFormat static field — shared across all classes for consistent numeric displayEPSILON = 1E-9constant — safe double equality tests (avoids== 0.0)decimalFormatManager(n)utility factory method- Driver tests expanded: setter chain, copy constructor, degenerate case (a=0)
Quadratic class upgrades:
yInterceptstored asOrderedPair(0, c)— geometric consistencyroots[]array ofOrderedPair— pre-computed at every state changecomputeRoots()new utility: real roots asOrderedPair(r, 0), complex asComplexOrderedPair(rp, ip)summary()method for rich multi-line output- All setters trigger full recompute chain (including roots)
- Epsilon-safe double comparisons throughout
OrderedPair & ComplexOrderedPair upgrades:
toString()now usesQuadraticDriver.DF.format()for clean numeric display (no trailing.0000000001noise)- Breadcrumbs added throughout — toggled by the driver's
SHOULD_SHOW_BREADCRUMBSflag
QuadraticDriver.java — The Command Center
The driver now doubles as a configuration hub. Three static constants
(SHOULD_SHOW_BREADCRUMBS, DF, EPSILON) are shared by
all four files, keeping formatting and debugging decisions in one place.
Key Changes from Concept #8
- Three static class-level constants replace inline magic values
decimalFormatManager()creates the sharedDecimalFormat— callable and reusableq5.setB(-4); q5.setC(9);tests that chaining setters keeps all computed values in sync- Degenerate test (a=0) demonstrates the exception-handling path
summary()replaces rawtoString()calls for richer driver output
OrderedPair.java — The Foundation
Unchanged in structure from Concept #6 — only two additions
that make the upgrade possible: DF.format() in toString() for cleaner output,
and breadcrumbs throughout for optional debug tracing.
Key Changes from Concept #8
toString()wraps coordinates inQuadraticDriver.DF.format(x)— no more(3.0000000001, 0.0)noise- Breadcrumb pattern added: all methods optionally print their name when
SHOULD_SHOW_BREADCRUMBSis true getX()andgetY()were already present from Concept #8 (needed for subclass access to private fields)
ComplexOrderedPair.java — The Subclass
ComplexOrderedPair extends OrderedPair,
inheriting its fields and methods, overriding toString() to produce
a + bi notation, and adding conjugate() and
modulus(). This is the class that makes complex roots displayable
without any special-case code in the caller.
Key Changes from Concept #8
toString()usesQuadraticDriver.DF.format()for all numeric values — consistent withOrderedPair- Breadcrumb added to constructors (follows the driver's debug toggle)
- Core structure unchanged — the
extendskeyword,super()calls, and method overrides are identical to Concept #8
Quadratic.java — The Full PCNICOTGSU Blueprint
The main upgrade lives here. The computeRoots() method
stores all roots as OrderedPair or ComplexOrderedPair objects.
Every setter triggers the full recompute chain. Read
the analysis page
for a detailed walk-through of why each design decision was made.
Key Changes from Concept #8
yInterceptnew ivar —OrderedPair(0, c), stored as a geometric point not just a numberroots[]new ivar —OrderedPair[]that holds real or complex roots (polymorphism!)computeYIntercept()new private utility — called in all constructors and setCcomputeRoots()new private utility — real roots asOrderedPair(r, 0); complex asComplexOrderedPair(rp, ip)summary()new public method — shows vertex, discriminant, y-intercept, and roots in one callgetYIntercept()new getter — returns the y-intercept ordered pair- All
a == 0checks useMath.abs(a - 0.0) < EPSILON(safe double comparison) + 0.0applied to vertex h to prevent the-0.0display artifact