@Override
  public double grade(double x) {
    double grade;
    if (x<a) {
      grade = 0;
    } else if (x>=a && x<b) {
      grade = (1 - (b-x)/(b-a));
    } else if (x>=b && x<=c) {
      grade = 1;
    } else if (x>c && x<=d) {
      grade = (1 - (x-c)/(d-c));
    } else {
      grade = 0;
    }
    return grade;
  }