Bom dia!
Estou aprendendo a matéria sobre Relacionamento entre classes (um p/ um, um p/ muitos);
Estou tentando realizar um exercício na qual tenho que:
"Escreva um programa Teste que crie um curso com 5 alunos e que peça para o usuário entrar com 4 notas de cada aluno.
Ao final, imprima a média de cada aluno, se o mesmo está aprovado (média maior ou igual a 7,0) e qual a média da turma."
Utilizando o relacionamento das classes. e estou com dificuldade na última parte onde devo calcular a média de toda a turma (no caso 5 alunos), creio que devo criar um vetor para armazenar a media dos alunos 1 ao 5, e depois calcular a média geral, mas ao utilizar outras classes fiquei perdido…
eis como está o código:
package cursos;
public class testeCursos {
public static void main(String[] args) {        
    
    //Dados dos Aluno 1 ao 5
    Aluno testeAluno1 = new Aluno("Huguinho");
    System.out.println("Informe a nota de "+testeAluno1.getNome());
    testeAluno1.lancarNotas();
    testeAluno1.exibirDados();        
    
    Aluno testeAluno2 = new Aluno("Zezinho");
    System.out.println("Informe a nota de "+testeAluno2.getNome());
    testeAluno2.lancarNotas();
    testeAluno2.exibirDados();
    
    Aluno testeAluno3 = new Aluno("Luizinho");
    System.out.println("Informe a nota de "+testeAluno3.getNome());
    testeAluno3.lancarNotas();
    testeAluno3.exibirDados();
    
    Aluno testeAluno4 = new Aluno("Luluzinha");
    System.out.println("Informe a nota de "+testeAluno4.getNome());
    testeAluno4.lancarNotas();
    testeAluno4.exibirDados();
    
    Aluno testeAluno5 = new Aluno("Duduzinho");
    System.out.println("Informe a nota de "+testeAluno5.getNome());
    testeAluno5.lancarNotas();
    testeAluno5.exibirDados();
    
    Aluno[] alunos = new Aluno[5];
    alunos[0] = testeAluno1;
    alunos[1] = testeAluno2;
    alunos[2] = testeAluno3;
    alunos[3] = testeAluno4;
    alunos[4] = testeAluno5;
    
    testeCursos.setAlunos(alunos);       
    
}
}
package cursos;
import java.util.Scanner;
public class Aluno {
private String nome;
private static int auxMatricula=100;
private int Matricula;
private float nota1;
private float nota2;
private float nota3;
private float nota4;    
public Aluno(String nome){
    this.nome= nome;
    this.nota1=0;
    this.nota2=0;
    this.nota3=0;
    this.nota4=0;
    this.Matricula = gerarMatricula();    
}
public String getNome() {
    return nome;
}
public void setNome(String nome) {
    this.nome = nome;
}
public int getMatricula() {
    return Matricula;
}
public void setMatricula(int Matricula) {
    Matricula = auxMatricula;
    this.Matricula = Matricula;
}
public float getNota1() {
    return nota1;
}
public void setNota1(float nota1) {
    this.nota1 = nota1;
}
public float getNota2() {
    return nota2;
}
public void setNota2(float nota2) {
    this.nota2 = nota2;
}
public float getNota3() {
    return nota3;
}
public void setNota3(float nota3) {
    this.nota3 = nota3;
}
public float getNota4() {
    return nota4;
}
public void setNota4(float nota4) {
    this.nota4 = nota4;
}
private static int gerarMatricula(){
    return ++auxMatricula;
}
public void exibirDados(){
    System.out.println("Nome:"+getNome());
    System.out.println("Matricula:"+getMatricula());        
    System.out.println("Nota 1:"+getNota1());
    System.out.println("Nota 2:"+getNota2());
    System.out.println("Nota 3:"+getNota3());
    System.out.println("Nota 4:"+getNota4());
    float media = +calcularMedia(getNota1(),getNota2(),getNota3(),getNota4());
    System.out.println("Media:"+media);        
    if(verificarAprovacao(media)){
        System.out.println("Aprovado!");
    }else{
        System.out.println("Reprovado!");
    }
    
}
public void lancarNotas(){           
    Scanner ler = new Scanner (System.in);
    System.out.println("Informe a Nota1:");
    nota1 = ler.nextFloat();
    System.out.println("Informe a Nota2:");
    nota2 = ler.nextFloat();
    System.out.println("Informe a Nota3:");
    nota3 = ler.nextFloat();
    System.out.println("Informe a Nota4:");
    nota4 = ler.nextFloat();
    System.out.println("Notas Lançadas com Sucesso");
            
}   
private float calcularMedia(float nota1, float nota2, float nota3, float nota4){        
    return (nota1+nota2+nota3+nota4) / 4;
}   
private boolean verificarAprovacao(float mediaCalculada){
    if(mediaCalculada>=7){ 
        return true;
    }
    else {
        return false;
    }       
}   
}
Não exatamente onde devo colocar o método para somar as notas dos 5 alunos e depois calculá-la…