import java.util.Scanner;
public abstract class Pregunta {
    private static final Scanner in = new Scanner(System.in);
    private static boolean fueraDeRango(int n, int min, int max) {
        return ((n < min) || (n > max));
    }
    public static int numEnRango(String s, int min, int max) {
        int n;
        do {
            System.out.print(s + " [" + min + "-" + max + "]: ");
            try {
                n = Integer.parseInt(in.nextLine());
            } catch (java.lang.NumberFormatException e) {
                n = Integer.MIN_VALUE; // Hopefuly fuera de rango
            }
        } while (fueraDeRango(n, min, max));
        return n;
    }
    public static boolean siONo(String pregunta) {
        String s;
        do {
            System.out.print(pregunta + "[s/n]: ");
            s = in.nextLine().toLowerCase();
        } while (!(s.equals("s") || s.equals("n")));
        return (s.equals("s"));
    }
}
