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, 23.06.2019 06:30
When early motion pictures played in movie theaters, they were often accompanied by live organ or piano music. which of the following are the most likely reasons that this happened? (select all that apply). the music was provided to distract audience members from the loud sounds made when filmstrips were changed. the music accompanied the movies because the movies were silent and audiences were used to hearing music during plays in theaters. the music usually was played before, and sometimes after the movie, as an alternative form of entertainment. the music viewers to interpret the dramatic action in the films.
Answers: 2
question
Computers and Technology, 23.06.2019 09:30
You wanted to look up information about alzheimer's, but you were unsure if it was spelled "alsheimer's" or "alzheimer's." which advanced search strategy would be useful? a) a boolean search b) using a wild card in your search c) trying different search engines d) doing a search for "alsheimer's not alzheimer's" asap. ill give brainlist.
Answers: 1
question
Computers and Technology, 24.06.2019 21:40
Clunker motors inc. is recalling all vehicles in its extravagant line from model years 1999—2002 as well as all vehicles in its guzzler line from model years 2004—2007. a boolean variable named recalled has been declared. given a variable modelyear and a string modelname, write a statement that assigns true to recalled if the values of modelyear and modelname match the recall details and assigns false otherwise.
Answers: 2
question
Computers and Technology, 24.06.2019 21:50
The use of phrases, fragments, and punctuation can influence the mood of a passage; keeping this in mind, how would you describe the mood of the followingpassage? "fog on the essex marshes, fog on the kentish heights, fog creeping into the cabooses of collier-brigs; fog lying out on the yards, and hovering in the riggingof great ships; fog drooping on the gunwales of barges and small boats. fog in the eyes and throats of ancient greenwich pensioners, wheezing by thefiresides of their wards; fog in the stem and bowl of the afternoon pipe of the wrathful skipper; fog cruelly pinching the toes and fingers of his shivering little'prentice boy on deck." (5 points)
Answers: 2
You know the right answer?
Please Help! Assume that you have an array named items containing 100 integers, and an integer name...
Questions
question
Advanced Placement (AP), 11.10.2019 19:20
Questions on the website: 13722363