title: Entering mixed fractions into java
body: <p>I am trying to enter 1 5/8 into my code but keep getting the following error: </p>
  
  <p>run:</p>
  
  <pre><code>Exception in thread "main" java.lang.NumberFormatException: For input string: "1 5/8"
  at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1241)
  at java.lang.Double.parseDouble(Double.java:540)
  at ClientCode.main(ClientCode.java:42)
  
  Java Result: 1
  BUILD SUCCESSFUL (total time: 17 seconds)
  </code></pre>
  
  <p>this is my code: </p>
  
  <pre><code>[code] public double findFrac(int whole, String frac) {
    if (frac == null || frac.equals(""))
      return whole;
  String[] parts = frac.split("/");
  return whole + Integer.parseInt(parts[0]) / (double)Integer.parseInt(parts[0]);    
  </code></pre>