Chapter 5 answers and classes

Chapter 5
Interesting way of doing this..