Está en la página 1de 2

import java.util.

Scanner;
public class IMC4733 {
public static void main(String[] args) {
Scanner sc = new Scanner (System.in);
String nom4733,cat4733 = null;
double year4733,peso4733,alt4733,imc4733,age4733;
//Ingreso de datos con validacion
System.out.print("Ingrese su nombre: ");
nom4733 = sc.nextLine();
System.out.print("Ingrese su año de nacimiento: ");
year4733 = sc.nextDouble();
if(year4733 > 2017) {
System.out.print("Ingrese un año de nacimiento real: ");
year4733 = sc.nextDouble();
}

System.out.print("Ingrese su peso en Kilogramos: ");


peso4733 = sc.nextDouble();
if(peso4733 > 500){
System.out.print("Ingrese un peso real: ");
}
System.out.print("Ingrese su estatura en Metros: ");
alt4733 = sc.nextDouble();
if(alt4733 > 3){
System.out.print("Ingrese una altura real: ");
}
//Operación de edad e IMC
age4733 = 2017 - year4733;
imc4733 = peso4733/(alt4733*alt4733);

//Validacion de categoria del IMC


if(imc4733 < 16){
cat4733 = "Delgado Severo";
}
if (imc4733 >= 16 && imc4733 < 16.99) {
cat4733 ="Delgado Moderado";
}
if (imc4733 >= 17 && imc4733 < 18.49){
cat4733 = "Delgado Aceptable";
}
if (imc4733 >= 18.5 && imc4733 <24.99){
cat4733 = "Peso Normal";
}
if (imc4733 >= 25 && imc4733 < 29.99){
cat4733 = "Sobrepeso";
}
if (imc4733 >= 30 && imc4733 < 34.99){
cat4733 = "Obeso tipo 1";
}
if (imc4733 >= 35 && imc4733 < 40){
cat4733 = "Obeso tipo 2";
}
else if(imc4733 > 40){
cat4733 = "Obeso tipo 3";
}

//Impresion salida respuesta


System.out.println("Nombre: "+ nom4733 + "\nEdad: "+age4733+"\nIMC:
"+imc4733+"\nCategoria: " + cat4733);
}

También podría gustarte