Está en la página 1de 1

/*

* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to
change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Main.java to edit this
template
*/
package ejer2;

import java.util.Scanner;

/**
*
* @author danie
*/
public class Ejer2 {

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Scanner leer = new Scanner(System.in);
System.out.println("Ingresa la cantidad de estudiantes");
int n = Integer.parseInt(leer.nextLine());
Estudiante[] notas = new Estudiante[n];

for (int i = 0; i < n; i++) {


String[] linea = leer.nextLine().split(" ");

notas[i] = new Estudiante(linea[0], Integer.parseInt(linea[1]),


linea[2], Double.parseDouble(linea[3]));
}
int contador = 0;
//Mostrar nivel de cada estdiante
for (int i = 0; i < n; i++) {
System.out.println(notas[i].nivel());

if (notas[i].getNota() <= 4) {
contador++;
}
}

//Mostar numero de notas con nivel medio o inferior


System.out.println(contador);

//Nombre y ID de la nota mas baja


double notaMin = 6;
String nombreMin = "";
for (int i = 0; i < n; i++) {
if (notas[i].getNota() < notaMin) {
notaMin = notas[i].getNota();
nombreMin = notas[i].getNombre() + " " + notas[i].getId();
}
}

System.out.println(nombreMin);

También podría gustarte