import java.util.Scanner;
public class VerificarCompatibilidadDonarSangre {
static boolean esCompatible(int edad, float peso) {
String motivo = "";
if (edad < 18 || edad > 65) {
motivo = "Debe tener entre 18 y 65 años.";
}
if (peso < 50) {
motivo = "Debe pesar más de 65 kg.";
}
if (!motivo.isEmpty()) {
System.out.println("Donante incompatible.");
System.out.println("Motivo: " + motivo);
}
return edad < 65 && edad > 18 && peso > 50;
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int edad;
float peso;
System.out.print("Ingrese la edad del donante: ");
edad = sc.nextInt();
System.out.print("Ingrese el peso del donante (kg): ");
peso = sc.nextFloat();
if (esCompatible(edad, peso)) {
System.out.println("Donante compatible");
}
}
}