Пример #1
0
  /** return percentage of correct marks for given difficulty */
  public float getScore(Difficulty difficulty) {
    float total = 0;
    float completed = 0;

    for (Exercise e : exercises)
      if (e.getDifficulty() == difficulty) {
        total++;
        if (e.getMark() == Mark.CORRECT) completed++;
      }

    return completed / total;
  }