/** * This series class is the prototype class for all series */ public class series { protected double param = 0.0; protected int n = 0; protected double term = 0.0; protected double val = 0.0; /** * Class constructor for series */ series(){ param = 0.0; n = 0; term = 0.0; val = 0.0; } /** * Class constructor with parameter * * @param x is the parameter defining the series */ series(double x){ param = x; n = 0; term = 0.0; val = 0.0; } /** * Initializes the first term of series. */ public void first(){ n = 0; term = 0.0; val = 0.0; } /** * Advances to the next term of series. */ public void nextTerm(){ n++; term = term + param; val = val + term; } /** * Returns the value of the indexed term in series * * @parem m is the index of the term */ public double valAt(int m){ first(); for (int i=0; i