Exercise
Just as we extracted the time series code into its own class, we can also extract the moving average code into a separate class. Try doing this refactoring as an exercise. Once you are done, check out the Appendix for a walkthrough of one possible solution.