From 4e7d3754b69f6af8f84622a17d28103ce70021d1 Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Tue, 17 Mar 2015 18:45:26 +0100 Subject: Implementation with limited tests; no javadoc yet --- Week7/src/polynomial/Term.java | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Week7/src/polynomial/Term.java') 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 -- cgit v1.2.3