001package edu.pdx.cs410J.junit;
002
003import java.util.*;
004
005/**
006 * This class represents a student that may enroll in a section of a
007 * course.
008 */
009public class Student {
010
011  /** The student's id */
012  private String id;
013
014  /** The grades that the student received in the sections of courses
015   * that he was enrolled in */
016  private Map<Section, Grade> grades;
017
018  /////////////////////////  Constructors  //////////////////////////
019
020  /**
021   * Creates a new <code>Student</code> with a given id
022   */
023  public Student(String id) {
024    this.id = id;
025    this.grades = new HashMap<Section, Grade>();
026  }
027
028  //////////////////////  Accessor Methods  ////////////////////////
029
030  /**
031   * Sets the grade this student got in a given section of a course
032   */
033  public void setGrade(Section section, Grade grade) {
034    this.grades.put(section, grade);
035  }
036
037  /**
038   * Returns the grade this student received in a given sesion of a
039   * course.  Returns <code>null</code> if the student was never
040   * enrolled in the course or is no grade was assigned.
041   */
042  public Grade getGrade(Section section) {
043    return (Grade) this.grades.get(section);
044  }
045
046  /**
047   * Returns the grades that this student received 
048   */
049  public Map<Section, Grade> getGrades() {
050    return grades;
051  }
052
053  /**
054   * Returns the id of this student
055   */
056  public String getId() {
057    return id;
058  }
059}