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 14:10
Dean wants a quick way to look up staff members by their staff id. in cell q3, nest the existing vlookup function in an iferror function. if the vlookup function returns an error result, the text “invalid staff id” should be displayed by the formula. (hint: you can test that this formula is working by changing the value in cell q2 to 0, but remember to set the value of cell q2 back to 1036 when the testing is complete.)
Answers: 3
question
Computers and Technology, 22.06.2019 14:30
Create a pseudocode design to prompt a student for their student id and the titles of the three classes they want to add. the solution should display the student’s id and a total bill. • bill a student using the following rules: o students can only add up to 3 classes at a time.
Answers: 3
question
Computers and Technology, 23.06.2019 02:00
Which software would you use to create a print design? a. illustrator b. audacity c. reaper d. dreamweaver
Answers: 2
question
Computers and Technology, 23.06.2019 19:00
Acompany is hiring professionals for web designing. the firm is small with few resources. they want employees who possess problem-solving skills and can independently carry out responsibilities. which kind of employee should they select?
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
English, 03.02.2020 14:01
question
Mathematics, 03.02.2020 14:01
question
Mathematics, 03.02.2020 14:01
Questions on the website: 13722360