Code Example Ch 08-2
Assume you have an int array, candy, which stores the number of candy bars sold by a group of children where candy[j] is the number of candy bars sold by child j. Assume there are 12 children in all.
-Refer to Code Example Ch 08-2: What does the following method do? public int question15()
{
Int value1 = 0;
Int value2 = 0;
For (int j = 0; j < 12; j++)
If (candy[j] > value1)
{
Value1 = candy[j];
Value2 = j;
}
Return value2;
}
A) It returns the total number of candy bars sold.
B) It returns the total number of children who sold zero candy bars.
C) It returns the total number of children who sold more than zero candy bars.
D) It returns the number of candy bars sold by the child who sold the most candy bars.
E) It returns the index of the child who sold the most candy bars.
Correct Answer:
Verified
Q25: If any int array, a, is passed
Q26: What does the following statement do? int[]
Q27: A polygon object in Java is
A) a
Q28: Assume list is an array of int
Q29: A polyline object in Java is
A) an
Q31: Write a method to compute the average
Q32: The class Name consists of 4 instance
Q33: Code Example Ch 08-2
Assume you have an
Q34: Code Example Ch 08-2
Assume you have an
Q35: Which of the following would declare a
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents