subject

Write a public static method named average which takes an ArrayList of Double objects, and returns the average of the values in this list. Write your average method in the U7_L2_Activity_Two class. Use the runner class to test your method but do not add a main method to the U7_L2_Activity_Two. java file or your code will not be scored correctly. Hint: when you write your method header, and specify the type of the parameter as an ArrayList, make sure you include the data type your ArrayList will contain in angle brackets (<>). The following content is partner provided This is runner code:
import java. util. Scanner;
import java. util. ArrayList;
public class runner_U7_L2_Activity_Two{
public static void main(String[] args){
Scanner scan = new Scanner(System. in);
ArrayList vals = new ArrayList();
System. out. println("Enter ArrayList length:");
int len = scan. nextInt();
System. out. println("Enter values:");
for(int i = 0; i < len; i++){
vals. add(scan. nextDouble());
}
System. out. println("Average: " + U7_L2_Activity_Two. average(vals));
}
}

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 22:50
Before you enter an intersection on a green light make sure
Answers: 2
question
Computers and Technology, 22.06.2019 23:00
Is an attack that relies on guessing the isns of tcp packets
Answers: 2
question
Computers and Technology, 23.06.2019 05:20
Which operating system is a version of linux?
Answers: 1
question
Computers and Technology, 23.06.2019 06:00
Which statistical function in a spreadsheet you to see how far each number varies, on average, from the average value of the list?
Answers: 2
You know the right answer?
Write a public static method named average which takes an ArrayList of Double objects, and returns t...
Questions
question
Mathematics, 19.05.2020 03:22
question
Mathematics, 19.05.2020 03:22
question
Health, 19.05.2020 03:22
Questions on the website: 13722367