Index
Overview


In this challenge we'll take another look at the Stats Challenge, but using a different approach.

We'll take an algorithm (recipe) approach.

Recipes


The recipes for Assignment A2 are provided in step-by-step fashion here:


Also see unit tests are the key

Work To Do


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());
}


Unit Tests and UI Provided


Unit tests and UI are provided here....

The unit tests are completed with pretty good coverage. You should be able to run as-is.

Here is the suggested run order:


Scoring


Your code solutions do not need to follow the algorithms strictly or anything of that sort.

We are looking for:


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).