Overview


The ave (mean) is the sum divided by the count.

Code Reuse 💡


This is the most important solution in this challenge.

Why? Because it allows us to learn and use the concept of "code reuse", which
simply means as they name implies, reusing code (that is already done).

We know that ave is:

ave = sum / count


We look at our object and see that there is a sum method and a "count" method.

Thus we are able to delegate all the work to others. This makes our job easy.

Our solution:
//handle special case first
if (this.count() == 0) return null;

//now delegate
return this.sum() / this.count();