This method accepts a one-dimensional array as its argument


Write a class name MyArray with the following methods:

* getTotal: this method accepts a one-dimensional array as its argument and return the total of the values in the array. Write overloaded version of this method that work with int, float, double, and long arrays.
* getAverage: this method accepts a one-dimensional array as its argument and return the highest value in the array. Write overloaded version of this method that work with int, float, double, and long arrays.
* getLowest: this method accepts a one-dimensional array as its argument and return the lowest value in the array. Write overloaded version of this method that work with int, float, double, and long arrays.
* getHighest: this method accepts a one-dimensional array as its argument and return the highest value in the array. Write overloaded version of this method that work with int, float, double, and long arrays.

Write a constructor for MyArray to accepts a one-dimensional array type: int, float, double, and long.

Demonstrate the class MyArray by creating a MyArrayDemo class. The purpose of the MyArrayDemo is to perform operation on one dimensional array.

* Create an array of 100 elements
* Fill the array with random numbers
* Create an object type MyArray an pass the array of 100 elements

Test MyArray methods by using the object MyArray for the following:

* Total values in an array
* Average the values in an array
* Find the highest value in an array
* Find the lowest value in an array
* Print the array in ascending order.
* Print the array in descending order.
* Generate a random number. Try to see if the generated number is within your array. Return the index of the array if the number is found. Return false it the number is not in your array. 

Request for Solution File

Ask an Expert for Answer!!
Basic Computer Science: This method accepts a one-dimensional array as its argument
Reference No:- TGS0146883

Expected delivery within 24 Hours