I need to add notes to certain students (each student has several notes and each note belongs to a subject), however as I am using arrayList and I have little knowledge in java I am well lost in passing parameters and how to add new values using function registrarNota
.
Someone could explain what I should do.
PS (I can not use Extends)
Student class:
package auladia24;
import java.util.ArrayList;
public class Aluno {
private String nome;
private String ra;
private ArrayList<Nota> notas = new ArrayList(); // tipo da array e o nome da array
public Aluno(String nome, String ra){
this.nome = nome;
this.ra = ra;
}
public String getNome (){
return this.nome;
}
public String getRa(){
return this.ra;
}
public ArrayList getNotas(){
return this.notas;
}
public Nota registrarNota(double valor, Disciplina nomeDisciplina){
}
}
Class Note:
package auladia24;
public class Nota {
private double valor ;
private Disciplina nomeDisciplica;
public void nota (double nota, Disciplina nomeDisciplina){
this.valor = valor;
this.nomeDisciplica = nomeDisciplica;
}
public double getNota(){
return this.valor;
}
public Disciplina getDisciplina(){
return this.nomeDisciplica;
}
}
Class Discipline:
package auladia24;
public class Disciplina {
private String nome;
public Disciplina (String nome){
this.nome = nome;
}
public String getNome(){
return this.nome;
}
}