Answer the question
In order to leave comments, you need to log in
How can I make multiple grades for the Student class?
There is a task.
Create class Student. The grades received by students in a session are attributes of the Student class. Determine:
....
b) the average score of each student;
d) the number of students who have "2".
..........
public class Student {
private int mark;
public void setMark(int mark) {
this.mark = mark;
}
public int getMark() {
return this.mark;
}
}
Answer the question
In order to leave comments, you need to log in
public class Student {
private List<Integer> marks = new ArrayList<>();
public void addMark(int mark) {
this.marks.add(mark);
}
public List<Integer> getMarks() {
return marks;
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question