finished code for quiz1 of chapter5, in package T1