finished code for example PowereCalc.java in chapter5, section 8