begin code for quiz3 in chapter9