finished code for quiz3 in chapter5, tkgWeight.java