public class Aluno {
private String nome;
private double[] notas;
public Aluno(String nome, double[] notas) {
this.nome = nome;
this.notas = notas;
}
public double calcularMedia() {
double soma = 0;
for (double nota : notas) {
soma += nota;
}
return soma / notas.length;
}
public String getNome() {
return nome;
}
}
To embed this program on your website, copy the following code and paste it into your website's HTML: