Index
Overview


Goals:

So that we can focus on these two things you do not need to do any view (html) work. However, a view is provided for fun and you might find it handy as you code. Note that we are focusing more on the model side of things as we have other view-related courses (html/css). However, as the semester goes on, and time permits, we will be beautifying our views.

Videos and Hints



Problem Statement


We are coding a statistics calculator (not with heavy math).

The calculator will receive an array of numbers as input and calculate some statistical information about the input. The details are described below.

Object Diagram First


The best way to start any object coding project is with a simple object diagram.

We'll walk through how to do that for this challenge here:


Coding Instructions


We are coding a statistics calculator (not with heavy math).

Open the "model.js" file and you will find the start of the "Stats" class.

Look for the tags "//TODO" and code those methods. You'll want to replace this line "return undefined;" with the return of your calculated result. You will find a description (above the tag), that describes the specific challenge problem (method).

Note that all of your coded methods will return a number except "mode" which returns an array (of size one to many).

Unit Testing (Grade & Correct Your Own Work) 💡


Unit testing is optional. It will not be graded. However, it lets you grade, and correct as needed, your own work. The test case has already been started for you.

Note that if you decide to use this unit testing you will want to add more tests (they can follow the ones started closely).

A step-by-step guide example is provided (see References).

The file "unit-test.html" is ready to run with some tests pre-loaded (coded). You can add more tests (and test cases) as desired.

To good to be true right?

Scoring


Scoring is all based off of the model class "Stats".

Scoring, for each method, will check the "actual" return value vs an "expected" value (for a variety of input).

For example, if we have an array of nums [10, 20, 30, 40] we would expect that a Stats object return a "sum" of 100.

The points are spread out evenly for all the stat calc methods except these two are worth less:


Provided Code



Important Files


FileDirectoryDescription
model.jsstats\modelThe class "Stats" (started) is where you'll code your stats calcs and array manipulation (graded)
stats\testUnit Tests (started). This is optional and (not graded)
stats\uiView (started). Just for fun (not graded).


Submitting


Please zip up your entire "stats" working directory into a ZIP file named in the usual way ("Assignment XX -- FirstName LastName.zip" where "XX" is the assignment number and FirstName and LastName are your corresponding names in D2L).

References


All the chapters in "Part IV (Labs)" will come in handy, especially "Arrays".

Also:

Here are some fun references on statistics calcs: