Im running into a problem in my code and cant figure out how I can get it to restart or exit upon completion.

public static void main(String[] args) {

JOptionPane.showMessageDialog(null, "Welcome to Morgage Calculator", "McBride Financial INC", JOptionPane.PLAIN_MESSAGE);
    String princible;
        princible = JOptionPane.showInputDialog(null, "Step 1:   Enter Mortgage Amount" );
    String IR;
        IR = JOptionPane.showInputDialog(null, "Step 2:   Enter Interest Rate example 5.75 for 5.75%");
    String years;
        years = JOptionPane.showInputDialog(null, "Step 3:   Enter Term Limit in years");

JOptionPane.showConfirmDialog(null, "Would you like to enter new data?", "McBride Financial INC", JOptionPane.YES_NO_OPTION);

...After YES_NO_OPTION I cant get it back to enter new Mortgage info

Any insight would be great!

Edited by mike_2000_17: Fixed formatting

7 Years
Discussion Span
Last Post by jon.kiparsky

Are you getting the return value from the final dialog? Use that to control a loop.

boolean again = true;
while (again)
  all of that;
  if (dialog returns YES_OPTION) { do one thing} 
  else if (dialog returns NO_OPTION {do another thing}
  else { uh-oh, this shouldn't happen!)


Edited by jon.kiparsky: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.