Modify the program you wrote for homework
to be written in a
modular fashion as follows:
- Write a method called generateNumbers that accepts the array
and n as parameters and loads the array with random values.
- Write a method called sum that given the array and number of
elements in the array as parameters will return the sum of those values.
- Write a method called average that given the array and number of
elements in the array as parameters will return the average of those
values. NOTE: This method can call the sum() method.
- Write a method called maxPosition that given the array and number of
elements in the array as parameters will return the position of the
largest value in the array. NOTE: That position can be used in main()
to display the largest value.
- In main() have the user specify how many numbers they want in
their array, n. Then called the methods created above and
display the values they return.
Submit your working program by email in the usual fashion.