Finished code for quiz3 in chapter9, T3.java