Project 20: Calculating Mean Absolute Deviation
Intro Problem: Suppose we asked 10 of your classmates how much they spent on their last haircut and obtained the following values:
5, 0, 50, 70, 100, 10, 30, 40, 140, 25
We know that the average (mean) haircut cost is $47 but how much do students typically deviate from this amount? For this question, we are interested in how "spread" out the dataset is.
There are a few different measures we could use (range, interquartile range, and absolute mean deviation). The absolute mean deviation is $34.40 which tells us the typical difference from a classmates' haircut cost to the average of $47. This shows us that the haircut costs vary widely.
An explanation for the absolute mean deviation is given below.
Project 20: Variable 'dataset' has been initialized. The variable dataset is an array of values. There is also a working method called getAverage(array).
getAverage returns the average of the values in the array.
Task: Appropriately initialize the value of 'amd' that represents the absolute mean deviation for dataset.
**If your code works for 5 test cases in a row, you can enter your e-mail address.
Universal Computational Math Methods:
pow(5,2) returns 25.0
abs(-3.0) returns 3
sqrt(49.0) returns 7.0