Modified code  from New Boston & Java for Dummies book