finished scanner.java