exercise for chapter 4 event handling