CS174: OOP - Drills - Computing the mean of arrays

Developed by Professor Tralie and Professor Mongan.


Exercise Goals

The goals of this exercise are:
  1. To do proper array indexing
  2. To use loops in concert with arrays
  3. To declare accumulator variables outside of loops that are used in loops, but whose state persists beyond the loop
  4. To use proper types
  5. To handle boundary cases
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.
Welcome to our online modules system! Be sure to log in with your Urinus ID before you proceed. For example, Professor Tralie's ID is ctralie. If you are not an Ursinus student, that's fine! Just make something up, and you can still run everything