Keyboard Input IndexOutOfBoundsException fixand JUnit Test added