diff options
Diffstat (limited to 'Week7/src/polynomial/Term.java')
-rw-r--r-- | Week7/src/polynomial/Term.java | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Week7/src/polynomial/Term.java b/Week7/src/polynomial/Term.java index 67bcf04..b8d9f16 100644 --- a/Week7/src/polynomial/Term.java +++ b/Week7/src/polynomial/Term.java @@ -105,6 +105,10 @@ public class Term { && coefficient == term.coefficient; } } + + public double apply(double x) { + return coefficient * Math.pow(x, exponent); + } /** * A static method for converting scanner input into a term. The expected |