title: Inserting a double variable in JOptionPane
body: <p>Im new to java and im having trouble with the code below. Im trying to convert a double variable to a string variable to use it in JOptionPane.showMessagedialog but its giving me an error which is listed below. </p>
  
  <pre><code>import javax.swing.JOptionPane;
  public class pricecalculatorchap5
  
  {
     public static void main(String [] args)
  
     {
           String priceinput;
           double wholesaleprice;
           double markupprice;
           double retailprice;
           String retailprice2;
           String pricecalculated;
  
       priceinput = JOptionPane.showInputDialog("Please enter the whole sale price of the item.");
       wholesaleprice = Double.parseDouble(priceinput);
  
  
            priceinput = JOptionPane.showInputDialog("Please enter the markeup price of the item.");
            markupprice = Double.parseDouble(priceinput);
  
  
       retailprice = ( (markupprice / 100) * wholesaleprice) + wholesaleprice;
       retailprice2 = Double.toString (retailprice);
  
  
  
       pricecalculated = JOptionPane.showMessageDialog("The price of the item is calculated as  " +  retailprice2 );  
  
  
     }
  }      
  </code></pre>
  
  <hr>
  
  <blockquote>
    <p><strong>ERROR</strong></p>
    
    <p>pricecalculatorchap5.java:28: error: no suitable method found for
    showMessageDialog(String)
         pricecalculated = JOptionPane.showMessageDialog("The price of the item is calculated as  " +  retailprice2 );<br>
                                      ^
        method JOptionPane.showMessageDialog(Component,Object) is not applicable
          (actual and formal argument lists differ in length)
        method JOptionPane.showMessageDialog(Component,Object,String,int) is not applicable
          (actual and formal argument lists differ in length)
        method JOptionPane.showMessageDialog(Component,Object,String,int,Icon) is not
    applicable
          (actual and formal argument lists differ in length) 1 error</p>
  </blockquote>