logo

Crowdly

Observe el siguiente código correspondiente a la clase Estudiante: public clas...

✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.

Observe el siguiente código correspondiente a la clase Estudiante:

public class Estudiante{

   private String nombre; 

   private int[] notas; 

   public Estudiante(String nombre) { 

      this.nombre = nombre;

      notas = new int[5]; 

   } 

   public void agregarNota(int indice, int nota) { 

       if(indice >= 0 && indice < notas.length) { 

         notas[indice] = nota; 

      } 

   } 

   public double calcularPromedio() { 

       int suma = 0; 

      for(int nota: notas) { 

          suma += nota; 

      } 

      return suma / (double) notas.length; 

   } 

}

¿Qué pasaría si alguien trata de agregar una nota en la posición 5 del arreglo?

¿Cuántos objetos de tipo Estudiante pueden ser creados usando esta clase?

¿Cuál es el valor de cada nota en el arreglo notas cuando se crea un nuevo Estudiante?

More questions like this

Want instant access to all verified answers on moodle.esen.edu.sv?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!