Question
JAVA Exercise Define a method computeAverage(int [] arr) that specifically calculates the average value of any int array outside the main method, and call this
JAVA Exercise Define a method computeAverage(int [] arr) that specifically calculates the average value of any int array outside the main method, and call this method in the main method to achieve the same effect as before. Activity 2: Search for extreme values in the array Write a program that allows the user to enter 3 numbers, and then find the maximum value and display it. The effect of the program is as follows:
The basic structure of the program is shown below, complete with other codes to achieve the above functions.
public class FindNumber { public static void main(String[] args) { Scanner input = new Scanner( System.in ); System.out.println("Enter 3 numbers:"); int[] nums = new int[3]; for (int i = 0; i
// other codes
}
}
Enter 3 numbers: 3. 5. 6. The maximun number is: 6
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started