finished code for quiz1 and quiz2 in chapter8