cleans up final version of prob8.java