The code could read the input as a String and test for the "." before trying to convert it to an int.