I want to create a condition for the variable "int edad" but I'm confused...
I need a condition to this line in particular
Integer.parseInt(JOptionPane.showInputDialog("Ingrese edad")),
this is a int variable and I want to verify that is between 0 and 100, then give a message to the user and ask again this variable.
package pruebas;
import javax.swing.JOptionPane;
public class Persona {
public static void main(String[] args) {
Estudiante [] misEstudiantes2 = new Estudiante[1];
for(int i = 0; i< misEstudiantes2.length; i++){
misEstudiantes2[i] = new Estudiante(JOptionPane.showInputDialog("Ingrese nombre").toUpperCase(),
Integer.parseInt(JOptionPane.showInputDialog("Ingrese edad")),
JOptionPane.showInputDialog("Ingrese carrera"),
Integer.parseInt(JOptionPane.showInputDialog("Ingrese año")),
Integer.parseInt(JOptionPane.showInputDialog("Ingrese mes")),
Integer.parseInt(JOptionPane.showInputDialog("Ingrese dia")),
Double.parseDouble(JOptionPane.showInputDialog("Ingrese sueldo")));
misEstudiantes2[i].estableceSueldo(1);
System.out.println("Objetos del array \n" + misEstudiantes2[i].dameNombre() + "\n" + misEstudiantes2[i].dameSueldo() + "\n" +
misEstudiantes2[i].dameCarrera() + "\n" + misEstudiantes2[i].dameFecha() + "\n" + "La edad es " + misEstudiantes2[i].dameEdad());
}
}
}