PROGRAMACIÓN 2

Informacion de 10 personas

import java.util.*;
public class Datos{
    public static void main(String []args){
            String nombre;
            int i,edad;
            int sexo;
            float peso;
            float estatura;
            double sueldo;
            int cuentamayores = 0;
            int cuentahmayores = 0;
            int cuentamflacas = 0;
            int cuentahviejos = 0;
            int cuentahgordos = 0;
            int cuentasintrabajo = 0;
            int cuentamgordas = 0;
            for(i=1; i<=10; i++){
                System.out.println("DATOS DE LA " + i + " PERSONA");
                Scanner dato = new Scanner(System.in);
                System.out.print("INTRODUCE EL NOMBRE DE LA PERSONA : ");
                nombre = dato.next();
                System.out.print("INTRODUCE LA EDAD DE LA PERSONA : ");
                edad = dato.nextInt();
                System.out.print("INTRODUCE EL PESO DE LA PERSONA : ");
                peso = dato.nextFloat();
                System.out.print("INTRODUCE LA ESTATURA DE LA PERSONA : ");
                estatura = dato.nextFloat();
                System.out.println("INTRODUCE EL SUELDO MENSUAL DE LA PERSONA");
                System.out.print("SI LA PERSONA NO TRABAJA TECLEE 0 : ");
                sueldo = dato.nextDouble();
                System.out.println("ELIGE EL SEXO DE LA PERSONA ");
                System.out.println("TECLEE 1 = HOMBRE");
                System.out.print("TECLEE 0 = MUJER : " );
                sexo = dato.nextInt();

                if(edad >= 18){
                        cuentamayores = cuentamayores + 1;
                }
                if(sexo == 1 && edad >=18){
                        cuentahmayores = cuentahmayores + 1;
                }
                if(sexo == 0 && peso > 60){
                        cuentamgordas = cuentamgordas + 1;
                }
                if(sexo == 0 && peso < 40 && sueldo > 30000){
                        cuentamflacas = cuentamflacas + 1;
                }
                if(sexo == 1 && edad > 60){
                        cuentahviejos = cuentahviejos + 1;
                }
                if(edad >= 18 && edad <= 25 && sexo == 1 && peso > 90){
                        cuentahgordos = cuentahgordos + 1;
                }
                if(sueldo == 0.0){
                    cuentasintrabajo = cuentasintrabajo + 1;
                }
            }
        
            
            System.out.println("==========================================");
            System.out.println("EL TOTAL DE PERSONAS MAYORES DE EDAD SON:" + cuentamayores);
            System.out.println("EL TOTAL DE HOMBRES MAYORES DE EDAD SON:" + cuentahmayores);
            System.out.println("EL TOTAL DE MUJERES OBESAS SON:" + cuentamgordas);
            System.out.println("EL TOTAL DE MUJERES DELGADAS CON SUELDO MAYOR A $30,000 SON:" + cuentamflacas);
            System.out.println("EL TOTAL DE HOMBRES VIEJOS SON:" + cuentahviejos);
            System.out.println("EL TOTAL DE HOMBRES OBESOS CON EDAD ENTRE 18 Y 25 AÑOS SON:" + cuentahgordos);
            System.out.println("EL TOTAL DE PERSONAS QUE NO TRABAJAN SON:" + cuentasintrabajo);
        }
}