1) write a set of libraries for encoder / mcp4812 - you need both .h and .c/.cpp files.
2) in your project, include them (use the multi-tab function of the incredibly challenged Arduino ide).
3) you should think about if the encoder routines should run from an isr or not.