Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a Java program, called VariousArrayTasks that has 4 static methods called fillArray() , sumArray() , avgArray() , and printArray() . The fillArray() method should

Write a Java program, called VariousArrayTasks that has 4 static methods called fillArray(), sumArray(), avgArray(), and printArray(). 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. This array will be an int array.

The fillArray() method should take no input and return an int array. It should be called from the main method.

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 return a double 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.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Understanding Oracle APEX 5 Application Development

Authors: Edward Sciore

2nd Edition

1484209893, 9781484209899

Students also viewed these Databases questions