completes prob8.java with basic test cases and compiler errors