title: Comparing doubles' fractions
body: <p>I'm struggling with the following code which supposed to compare numbers fractions and output some text to user informing him whether the fractions of numbers are the same, i.e. </p>
  
  <ul>
  <li><p>User inputs two doubles: <strong>3.14</strong> and <strong>4.14</strong></p></li>
  <li><p>Output: <strong>Fractions are the same</strong></p></li>
  <li><p>User input two double: <strong>3.14</strong> and <strong>4.15</strong> </p></li>
  <li>Output: <strong>Franctions are not the same</strong></li>
  </ul>
  
  <p>Somehow I've managed to compile the following code but once I tried to run it in Eclipse IDE I came accross the following notifications: </p>
  
  <ul>
  <li>Exception in thread "main" java.util.InputMismatchException</li>
  <li>at java.util.Scanner.throwFor(Scanner.java:909)</li>
  <li>at java.util.Scanner.next(Scanner.java:1530)</li>
  <li>at java.util.Scanner.nextDouble(Scanner.java:2456)</li>
  <li><p>at comparison.main(comparison.java:12)</p>
  
  <pre><code>  import java.util.Scanner;  
    class comparison
    {
       public static void main(String[] args)
       {
          Scanner scan = new Scanner(System.in); 
          double a,b; 
  
          a = scan.nextDouble(); 
          b = scan.nextDouble(); 
  
          compare(a,b); 
        }
  
       public static void compare(double n, double m)
       {
          if(n- Math.floor(n) == m - Math.floor(m))
             System.out.println("Fractions are the same"); 
          else
             System.out.println("Fractions are no the same");
       }
  
      }
  </code></pre></li>
  </ul>
  
  <p>I would love to obtain any proper explanation of my problems, I guess there are variety of different ways to solve this case in different way but can you please stick with my idea and help me out with this ? </p>
  
  <p>Thanks in advance!</p>