Programming Exercises

1:Implement a class called ArrayMath, containing the following methods to perform calculations on arrays:
  • A method called ArrayAverage that, as an argument, accepts an array of base type double (of any length) and returns the average of this array.

  • A method called ArraySum that accepts two arrays of base type int. The two arrays must have identical length. The method will add together each corresponding pair of array elements from the two arrays. Each sum is assigned to a corresponding element of a third array, which finally is returned to the caller.

  • A method called ArrayMax that finds and returns the maximum value in an array of base type int. The array argument can be of any length.

Write the code to test this class and ...

Get C# Primer Plus now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.