finished code for quiz3 in chapter5, named T2/tkgWeight.java