Solution for programming assignment 2

Comments are welcome!