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

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 20:00, hannahliebl2000
Need asap write a short paper describing the history and differences between six sigma, waterfall, agile, and scrum models. understanding these models can give you a good idea of how diverse and interesting it development projects can be. describe what the rationale for them is and describe their key features. describe the history behind their development. at least 400 words
Answers: 1
image
Computers and Technology, 23.06.2019 18:30, milkshakegrande101
Where can page numbers appear? check all that apply. in the header inside tables in the footer at the bottom of columns at the top of columns
Answers: 1
image
Computers and Technology, 24.06.2019 03:30, mprjug6
Which explains extrinsic motivation? a)motivation in which there is a reward b)motivation that is personally satisfying c)motivation that is personally meaningful d)motivation in which the subject is interesting
Answers: 1
image
Computers and Technology, 24.06.2019 16:00, ramirez5571
"gps interaction and cognitive process" respond to the following: imagine that you have been asked to design a gps product that will have voice recognition and bluetooth capability. discuss and conceptualize a user interaction model. predict two (2) problems that may arise in gps products with voice recognition and bluetooth capability. recommend solutions for each of these issues. attention is one of the six cognition processes. when attention is applied to a design, the goal is to make it easier for the end user to quickly locate where he / she should type information on the computer or mobile device screen. compare and contrast how the google search engine and the microsoft bing search engine employ the attention cognition process. provide your opinion as to which search engine better employs the attention cognition process and explain why.
Answers: 3
You know the right answer?
Please Help! Assume that you have an array named items containing 100 integers, and an integer name...

Questions in other subjects:

Konu
Chemistry, 25.02.2021 19:10
Konu
Mathematics, 25.02.2021 19:10
Konu
Mathematics, 25.02.2021 19:10