I would like to know how I can make the code repeat until it is correct, in this case greater than 400hrs
/**
* Metodo para obtener las horas de vuelo del piloto, con validacion de mayor a 400.
*/
public int HorasVuelo(){
Scanner sc = new Scanner(System.in);
int fakeHoraVuelo;
System.out.println("Ingrese las horas de vuelo del piloto");
fakeHoraVuelo = sc.nextInt();
if(fakeHoraVuelo < 400){
System.out.println("Lo sentimos, se necesita un Piloto con mas experiencia");
}
else{
System.out.println("Esplendido!");
HorasDeVuelo = fakeHoraVuelo;
}
return HorasDeVuelo;
}
I mean, if you enter for example 300, tell you the message and return to the beginning to ask for flight times again