solved exercise15 in chapter3