Working on a calculator in java and taking the values as String
<p>like "1+23"</p>

<p>parse to double for example.. then calculate..</p>

<p>but when  i have a decimal the program crashes  for example "1.1+2"  the program glitches on the 1.1  when i'm parsing it</p>

<pre><code> if(s.contains("+"))

    {
        int n = s.indexOf("+");




        String w1 = s.substring(0,n);

        String w2 = s.substring(n+1,s.length());

        part1= (long) Double.parseDouble(w1);
        part2 = (long)Double.parseDouble(w2);
</code></pre>

<p>Exception in thread "AWT-EventQueue-0" java.lang.NumberFormatException: For input string: "1.1"
    at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)</p>
