Question: * * Multiple Method Return Project * * For this application, you will write methods that satisfy a number of program requirements. * Start by

*
* Multiple Method Return Project
*
* For this application, you will write methods that satisfy a number of program
requirements.
* Start by creating your main method, this will be like all others. You will then
send data to methods that will perform
* certain functions and then they will return the result to the main method and
the main method will print out the result.
*
*1) takes an array of ints as a parameter and returns the sum of the integers in
the array.
*
*2) takes an array of ints as a parameter and returns the double average of the
integers in the array.
*
*3) takes an array of ints as a parameter and returns the largest integer in the
array.
*
*4) takes an array of ints as a parameter and returns the smalles integer in the
array.
*
*5) takes an array of ints as a parameter and returns the double average of the
even values in the array.
*
*/
//don't forget to alter the class and file name with your name, and comment your
code
class MultipleMethodsProject {
public static void main(String[] args){
Scanner scan = new Scanner(System.in);
//establish a fixed array to accept user input
int[] array = new int[5];
//Prompt the user for the integers
System.out.println("Please enter 5 integers");
//Loop to place values in to elements of the array,
//note how the scan is within the for loop to step in to each element
space and place the input value
for (int i =0; i < array.length; i++){
int arrayInt = scan.nextInt();
array[i]= arrayInt;
}
//you need to create each of the methods called from the print statement,
outside of the main
System.out.println("
Sum: "+ sum(array));
System.out.println("Average: "+ average(array));
System.out.println("Largest: "+ findMax(array));
System.out.println("Smallest: "+ findMin(array));

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!