you can use String token = in.nextLine(); replace nextInt and nextDouble
and then int value=Integer.parseInt(token) and double value= Double.parseDouble(token)

Here Example:
...