title: Inconvertible types error in java
body: <p>I have the following code:</p>
  
  <pre><code>import javax.swing.JOptionPane;
  
  public class Excercise613 {
      /** 
        *  Display the prompt to the user; wait for the user to enter
        *  a whole number; return it.  
        */            
  
      public static int askInt(String prompt) {    
          String s = JOptionPane.showInputDialog(prompt);
          Double d = Double.parseDouble(s);
          return d &gt;= 0 ? (int) d : (int) (d - 1);
      } // End of method
  } // End of class
  </code></pre>
  
  <p>When I compile this, I get an error at the bottom of the screen that says "inconvertible types.
       required: int; found: java.lang.Double" And then it highlights the "(int) d" piece of code.</p>
  
  <p>What am I doing wrong here? Why isn't the type casting working?</p>