complex example from Chapter 2; still needs to be debugged. will not compile using 'javac -d . *.java'