completed code for Term plan printing