By request, see the attached file for an early look at the source code for the Calculator Service as a Visual Studio 2010 project.
This is a work in progress. Some features are not yet implemented, and I haven’t yet explained some of the implemented features. Use at your own risk, no warranties implied, etc.
Note that I’ve found that an iisreset is usually required after retracting and before re-deploying the solution.