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, 22.06.2019 11:00
Lisa’s company, abc ltd., lost its biggest client and is now facing a financial crunch. most of her colleagues have resigned, but lisa decides to stay with the company and assist the management in overcoming the financial situation. which quality is lisa demonstrating? a. self-management b. cooperativeness c. responsibility d. loyalty
Answers: 2
question
Computers and Technology, 23.06.2019 00:50
Representa os dados de um banco de dados como uma coleç? o de tabelas constituídas por um conjunto de atributos, que definem as propriedades ou características relevantes da entidade que representam. marque a alternativa que representa o modelo descrito no enunciado. escolha uma:
Answers: 3
question
Computers and Technology, 24.06.2019 12:40
Match the feature to the network architecture. expensive to set up useful for a small organization easy to track files has a central server inexpensive to set up difficult to track files useful for a large organization does not have a central server client- server network peer-to-peer network
Answers: 3
question
Computers and Technology, 24.06.2019 17:00
Anew author is in the process of negotiating a contract for a new romance novel. the publisher is offering three options. in the first option, the author is paid $5,000 upon delivery of the final manuscript and $20,000 when the novel is published. in the second option, the author is paid 12.5% of the net price of the novel for each copy of the novel sold. in the third option, the author is paid 10% of the net price for the first 4,000 copies sold, and 14% of the net price for the copies sold over 4,000. the author has some idea about the number of copies that will be sold and would like to have an estimate of the royal- ties generated under each option. write a program that prompts the author to enter the net price of each copy of the novel and the estimated number of copies that will be sold. the program then outputs he royalties under each option and the best option the author could choose. (use appropriate named constants to store the special values such as royalty rates and fixed royalties.
Answers: 1
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, 26.03.2020 01:58
question
Mathematics, 26.03.2020 01:58
question
History, 26.03.2020 01:58
Questions on the website: 13722367