diff options
author | Jesse Morgan <jesse@jesterpm.net> | 2015-05-18 07:16:16 -0700 |
---|---|---|
committer | Jesse Morgan <jesse@jesterpm.net> | 2015-05-18 07:16:16 -0700 |
commit | 2e76039d4ecaff8d2ed40b67c309c2498ff4a1d5 (patch) | |
tree | 30bc97d1148118adaca0d1b1a0e59bddaa2bcb87 /src/com/p4square/grow/model | |
parent | b5ad47d5b77bfc023b9d3d466f9fd9ed2c29a452 (diff) |
Changing assessment scoring model.
Previously scores aligned on the answer values: 0 (seeker), 2, 3, and 4
(teacher).
Now scores align halfway between: 0 (seeker), 1.5, 2.5, 3.5 (teacher)
Diffstat (limited to 'src/com/p4square/grow/model')
-rw-r--r-- | src/com/p4square/grow/model/Score.java | 46 |
1 files changed, 37 insertions, 9 deletions
diff --git a/src/com/p4square/grow/model/Score.java b/src/com/p4square/grow/model/Score.java index f7920dd..82f26c9 100644 --- a/src/com/p4square/grow/model/Score.java +++ b/src/com/p4square/grow/model/Score.java @@ -11,17 +11,20 @@ package com.p4square.grow.model; */ public class Score { /** - * Return the integer value for the given Score String. + * Return the decimal value for the given Score String. + * + * This method satisfies the invariant for Score x: + * numericScore(x.toString()) <= x.getScore() */ - public static int numericScore(String score) { + public static double numericScore(String score) { if ("teacher".equals(score)) { - return 4; + return 3.5; } else if ("disciple".equals(score)) { - return 3; + return 2.5; } else if ("believer".equals(score)) { - return 2; + return 1.5; } else if ("seeker".equals(score)) { - return 1; + return 0; } else { return Integer.MAX_VALUE; } @@ -35,6 +38,11 @@ public class Score { count = 0; } + public Score(double sum, int count) { + this.sum = sum; + this.count = count; + } + /** * Copy Constructor. */ @@ -68,17 +76,37 @@ public class Score { return sum / count; } + /** + * @return the lowest score in the same category as this score. + */ + public double floor() { + final double score = getScore(); + + if (score >= 3.5) { + return 3.5; // teacher + + } else if (score >= 2.5) { + return 2.5; // disciple + + } else if (score >= 1.5) { + return 1.5; // believer + + } else { + return 0; // seeker + } + } + @Override public String toString() { final double score = getScore(); - if (score >= 4) { + if (score >= 3.5) { return "teacher"; - } else if (score >= 3) { + } else if (score >= 2.5) { return "disciple"; - } else if (score >= 2) { + } else if (score >= 1.5) { return "believer"; } else { |