ComputerScienceExpert

(11)

$18/per page/

About ComputerScienceExpert

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Applied Sciences,Calculus See all
Applied Sciences,Calculus,Chemistry,Computer Science,Environmental science,Information Systems,Science Hide all
Teaching Since: Apr 2017
Last Sign in: 103 Weeks Ago, 3 Days Ago
Questions Answered: 4870
Tutorials Posted: 4863

Education

  • MBA IT, Mater in Science and Technology
    Devry
    Jul-1996 - Jul-2000

Experience

  • Professor
    Devry University
    Mar-2010 - Oct-2016

Category > Programming Posted 03 May 2017 My Price 8.00

MethodsArrays

MethodsArrays

Write a Java program, called MethodsArrays that has 4 static methods called fillArray(), sumArray(), avgArray(), and printArray(). The fillArray() method should be called from the main method. The fillArray() method should use a Scanner to take in a number representing the length of the array and then read in numbers to fill the array.

The sumArray() method should take an int array as its input parameter and returns an integer value that is the sum of all the elements in the array.

The avgArray() method should take an int array as its input parameter and returns an integer value that is the average of all the elements in the array.

The printArray() method should take an int array as its input parameter and has no return value. It should then print out the elements of the array on the same line separated by a space (" "). All methods should work for integer arrays.

 

Input

n, where n is the length of the array, followed by m numbers

 

Sample input

3 2 3 4

 

Output

The program should print to the screen the sum of all the elements in the array, and the average of all the elements in the array followed by the array elements printed to the screen separated by a space.

 

Sample output

Sum = 9

Average = 3

2 3 4

Note: The Message for sum is: "Sum = " and the message for average is: "Average = "

 

In your code these should match EXACTLY to pass all test cases.

Answers

(11)
Status NEW Posted 03 May 2017 02:05 AM My Price 8.00

-----------

Not Rated(0)