From 94866b26c066e4b8f94fe4d79b1192482167265a Mon Sep 17 00:00:00 2001 From: Nacho Date: Mon, 14 Sep 2026 10:59:10 -0300 Subject: [PATCH] Create age classification program This program classifies a person's age into categories based on input. --- clasificacion_edad.java | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 clasificacion_edad.java diff --git a/clasificacion_edad.java b/clasificacion_edad.java new file mode 100644 index 0000000..6f63452 --- /dev/null +++ b/clasificacion_edad.java @@ -0,0 +1,22 @@ +import java.util.Scanner; + +public class clasificacion_edad { + public static void main(String[] args) { + Scanner scanner = new Scanner(String.class.cast(System.in)); + System.out.print("Ingresa tu edad: "); + int edad = scanner.nextInt(); + + if (edad < 0) { + System.out.println("Edad no válida."); + } else if (edad <= 12) { + System.out.println("Categoría: Niño/a"); + } else if (edad <= 17) { + System.out.println("Categoría: Adolescente"); + } else if (edad <= 64) { + System.out.println("Categoría: Adulto/a"); + } else { + System.out.println("Categoría: Adulto mayor"); + } + scanner.close(); + } +}