Solved chapter 5 exercises