public abstract class Progression { protected long first; protected long current; public Progression(long start) { current=first=start; } public long firstValue() // Reset the progression to the first value and return that value. { current=first; return current; } public abstract long nextValue(); // Step the progression to the next value and return that value. public void printProgression(int length) // Print the first 'length' values of the progression. { System.out.print(firstValue()); for (int i=2; i<=length; i++) System.out.print(" "+nextValue()); System.out.println(); } }