My solution for programming assignment 2

This was an interesting assignment.  After putting {} around 1 line
functions, I found it much easier to understand.