package assign5; import java.util.ArrayList; import java.util.Iterator; /** * Represents a student and their scores in a class. * Stores the name, assignment scores and exam scores. * @author Jill Seaman * */ public class Student { 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 an iterator over the collection of assignment scores */ public Iterator getAssignmentIterator() { return assignments.iterator(); } /** * @return an iterator over the collection of exam scores */ public Iterator getExamIterator() { return exams.iterator(); } }