CS174: OOP - Drills - Computing the mean of arrays
Explorer
GitHub
Connect to GitHub to push and pull your project files to a repository.
On the page that opens, create a token with repo scope, copy it, then paste it below.
Paste the personal access token you created on GitHub with repo scope.
Click Refresh to load commit history
Exercise Info
Goals
To do proper array indexing
To use loops in concert with arrays
To declare accumulator variables outside of loops that are used in loops, but whose state persists beyond the loop
To use proper types
To handle boundary cases
Instructions
Fill in a method to compute the mean of an array of ints. Note that even though the inputs are integers, their mean may be a decimal number! For example, the mean of {0, 5, 2, 4} is 2.75. Finally, if an empty array is passed to your method, you should return 0.0. Recall that this is referred to as a boundary case or edge case in testing.