title: Using Math.floor on a double variable won't work. Java (Using Eclipse)
body: <p>So basically I tried 2 things. I'll gives you the codes for them:</p>
  
  <pre><code>double number;
  Scanner input = new Scanner(System.in);
  System.out.println("Name a number!");
  number = input.nextDouble();
  number = Math.floor(number);
  System.out.println(number);
  </code></pre>
  
  <p>and this one:</p>
  
  <pre><code>double number;
  Scanner input = new Scanner(System.in);
  System.out.println("Name a number!");
  number = Math.floor(input.nextDouble());
  System.out.println(number);
  </code></pre>
  
  <p>But they both don't seem to work... Can anybody help me with this? I basically want to round up the user's input. Is it possible to turn a double into an integer? For example: The console asks "How many fries do you want" then the user decides to be funny and say 4.5. This would give me an error. I want the console to automatically turn the 4.5 into 4.</p>
  
  <p>EDIT: I don't know if this helps... But I only have 1 class and this is what the full class looks like:</p>
  
  <pre><code>package package.name;
  
  import java.util.Scanner;
  public class TestingJava
  {
      public static void main(String[] args){
          double number;
          Scanner input = new Scanner(System.in);
          System.out.println("Name a number!");
          number = input.nextDouble();
          number = Math.floor(number);
          System.out.println(number);
      }
  }
  </code></pre>
  
  <p>And this is the error I get whenever I type a number like 3.6:</p>
  
  <pre><code>Exception in thread "main" java.util.InputMismatchException
      at java.util.Scanner.throwFor(Unknown Source)
      at java.util.Scanner.next(Unknown Source)
      at java.util.Scanner.nextDouble(Unknown Source)
      at package.name.TestingJava.main(TestingJava.java:10)
  </code></pre>
  
  <p>When I give the number "2" it replies back "2.0" but when I make a fraction it just won't work.</p>