O'Reilly logo

C# Primer Plus by Klaus Michelsen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required