package assign5; import java.util.ArrayList; /** * Represents a student and their scores in a class. * Stores the name, assignment scores and exam scores. * @author Jill Seaman * */ public class Student extends Observable { private String name; // Students full name private ArrayList assignments // scores for the assignments = new ArrayList(); private ArrayList exams // scores for the exams = new ArrayList(); /** * Constructs the student from their name * @param name full name of the student. */ public Student(String name) { this.name = name; } /** * @return the student's full name */ public String getName() { return name; } /** * Adds an assignment score to the collection of assignment scores for the student. * @param as the assignment score to add */ public void addAssignmentScore (double as) { assignments.add(as); } /** * Adds an exam score to the collection of exam scores for the student. * @param es the exam score to add */ public void addExamScore (double es) { exams.add(es); } /** * @return the average for the student */ public double getAverage() { // implement me! return 0; } /** * @return the number of assignments in the list */ public int getNumberOfAssignments() { return assignments.size(); } /** * @param i the index of the assignment to return * @return the assignment at position i */ public Double getAssignmentScore(int i) { return assignments.get(i); } /** * @return the number of exams in the list */ public int getNumberOfExams() { return exams.size(); } /** * @param i the index of the exam to return * @return the exam at position i */ public Double getExamScore(int i) { return exams.get(i); } }