posted 23 years ago
I'm not sure that putting in lots of System.exit() calls is what was wanted. One of the main problems with the example given is that it is all in the main method. This just about makes sense in a program this small, but for anything larger you really should split it into smaller methods and classes. Here's another rewritten version, with things split off into (I hope) understandable concepts and operations. It's a bit more wordy, but I really do think it is more maintainable. See what you think...