Looping depending on a comand
I want my program to restart agian as long as the user clicks yes in the JOpition box and if they click NO i want it to close the program. I think i should use a while loop but dont know hoe. Can any one help:
void program()
{
int total= displayFirst()+displaySecond()+displayThree();
JOptionPane.showMessageDialog(null,"The total score for all three rounds is"+ total);
}
public static void main(String[] args)
{
diceGame game = new diceGame();
int peter=JOptionPane.showConfirmDialog(null,"Do you wish to play agian?","Dice Game", JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE);
if(peter==JOptionPane.YES_OPTION)
{
game.program();
}
else if(peter==JOptionPane.NO_OPTION)
{
System.out.println("" );
}

