subject

Please Help! Assume that you have an array named items containing 100 integers, and an integer named numItems that represents the number of valid integers currently used in the array. All elements from items[numItems] to items[items. length-1] have values of 0.

The following code is designed to calculate and print the average of the valid array elements:

int sum=0, count;
for (count = 0; count < items. length; count++)
{
statement 1
}
statement 2

Which of the following substitutions for and will cause this code to correctly print the average of the valid array elements in items?

A. Statement 1:
sum += items[count];

Statement 2:
System. out. println((double)sum / count);

B. Statement 1:
sum += items[count];

Statement 2:
System. out. println((double)sum / items. length);

C. Statement 1:
sum += items[count];

Statement 2:
System. out. println((double)sum / numItems);

D. Statement 1:
sum += items[items. length-1];

Statement 2:
System. out. println(sum / 100);

E. Statement 1:
sum += items[items. length-1];

Statement 2:
System. out. println((double)sum / numItems);

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 16:30
Corey set up his presentation for delivery to his team.the information he had to convey was critical to their job performance.he knew he would need a lot of time to explain each point
Answers: 3
question
Computers and Technology, 22.06.2019 18:30
Which of the following commands is more recommended while creating a bot?
Answers: 1
question
Computers and Technology, 23.06.2019 18:00
Which is a possible benefit of having a good credit history? having a checking account low interest rate on a car loan high interest rate on a credit card offer bankruptcy
Answers: 1
question
Computers and Technology, 24.06.2019 03:30
It is not necessary to develop strategies to separate good information and bad information on the internet. true or false
Answers: 1
You know the right answer?
Please Help! Assume that you have an array named items containing 100 integers, and an integer name...
Questions
question
Mathematics, 28.04.2021 01:00
question
Mathematics, 28.04.2021 01:00
question
English, 28.04.2021 01:00
question
Mathematics, 28.04.2021 01:00
question
Mathematics, 28.04.2021 01:00
question
Chemistry, 28.04.2021 01:00
Questions on the website: 13722367