0
I need to add notes to certain students (each student has several grades and each grade belongs to a discipline), but as I am using Ist arrayand have little knowledge in java I am well lost in passing parameters and how to add new values using the function registrarNota
.
Could someone explain what I should do.
PS(I cannot 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;
}
}
Classe Disciplina:
package auladia24;
public class Disciplina {
private String nome;
public Disciplina (String nome){
this.nome = nome;
}
public String getNome(){
return this.nome;
}
}
You can use another way to store that is not arraylist, such as map?
– user28595
I believe so Diego
– Lucas Alves
If I understand correctly, you want to store grades and discipline in the student so that you can relate the grade to the discipline, that’s right?
– user28595
That’s exactly what
– Lucas Alves