This challenge is a bit different. Here are the basic steps (for each method in class "Stats"):
Review Your Code
Compare your solution against the provided algorithm
If Tweaks Needed
This is for the case where you want to change/tweak your code based on the provided recipe.
Do the tweaks, test.
Add this line shown to the top of your method: //tweaked.
foo() {
//tweaked
const unit = new Stats([40, 10, 30, 20]);
this.assertEquals(10, unit.min());
}
If No Tweaks Needed
This is for the case where you do not want to change/tweak your code based on the provided recipe. Note that in this case your solution should be as clear or clearer than the recipe approach, and your original method to be passing all the cases.
Add this line shown to the top of your method: //no tweaks needed.
foo() {
//tweaked
const unit = new Stats([40, 10, 30, 20]);
this.assertEquals(10, unit.min());
}
Your code solutions do not need to follow the algorithms strictly or anything of that sort.
We are looking for:
the correct results (e.g. unit tests are a good indicator)
simple, clear code
NOTE WELL -- just as an example, let's say you did really well on the original A2 (correct results and clear code) except for the methods "max" and "mode". The grader would then focus more of the grading on "max" and "mode" (as it would be fine to have "//no tweaks needed" by the other methods).