Need help with making this work. I can't get the System.format (prepayment) to work.

class Mortgage
{

 static NumberFormat fmat = NumberFormat.getCurrencyInstance();

    public static void main(String args[])
    {


      String input_amt =
      JOptionPane.showInputDialog("Enter loan amount: ");
      double loanAmount = Double.valueOf(input_amt).doubleValue();


     String input_rate   =
     JOptionPane.showInputDialog("Enter rate: ");
     double interestRate = Double.valueOf(input_rate).doubleValue();


     String input_term   =
     JOptionPane.showInputDialog("Enter term: ");
     int years = Integer.valueOf(input_term).intValue();

    String input_prepayment =   
    JOptionPane.showInputDialog( "Enter prepayment: ");
    double prepaymentAmt = Double.valueOf(input_prepayment).doubleValue();




     try
         {

     String message =
     String.format("Loan Amount:"+"  "+fmat.format(loanAmount)+"\n"+
     "Interest Rate:"+"  "+ interestRate +" %% \n"+
     "Term:"+"  "+years+" years\n\n")+"\n"+
     "Prepayment: "+" %%"\n";


      JOptionPane.showMessageDialog(null, message);
      }

          catch(NumberFormatException err)
          {
               System.out.println("Error Converting Number");
          }



    }
}

Multiple threads with the same question in less than a day means no answer for you. Figure it out on your own if it's that urgent.

problem solved

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.