prob8.java final submitted version