Я уже создаю программу для угадывания случайно сгенерированного числа программой. Все работает хорошо, но когда, наконец, угадал число, я хочу дать возможность повторить игру или выйти, но я не могу понять, как поставить время в конце. Вот моя работа.
public class Bucles_III {//class
public static void main(String[] args) {//main
int numero=0, eleccion=0;
String[] repeat={"Repetir", "Terminar"};
int repetir;
do{
int intentos=0;
int aleatorio=(int)(Math.random()*10);//Se genera el numero random
do{//do
intentos++;
String entrada=JOptionPane.showInputDialog(null, "Introduce un número entre 0 y 10: ", "Adivina el numero", 1);//Se introduce el numero elegido
eleccion=Integer.parseInt(entrada);//Se genera el numero elegido
if (eleccion<aleatorio) {//if
JOptionPane.showMessageDialog(null, (eleccion+" Es Muy Bajo. Reintenta.\nNumero de intentos: "+intentos), "Numero Muy Bajo", 1);
}//if
else if(eleccion>aleatorio){
JOptionPane.showMessageDialog(null, (eleccion+" Es Muy Alto. Reintenta.\nNumero de intentos: "+intentos), "Numero Muy Alto", 1);
}
}//do
while(eleccion!=aleatorio);
JOptionPane.showMessageDialog(null, ("Tu numero: "+eleccion+"\nNumero generado: "+aleatorio+"\nIntentos Totales: "+intentos), "Felicidades", 3);
repetir = JOptionPane.showOptionDialog(null, "Repetir?: ", "Volver a intentarlo", 0, 3, null, repeat, repeat[0]);
}while(repetir==0);
}//main
} // class