515
students in a class.
b.Declare a one-dimensional array quizAvgwhose components will contain
floating-point quiz score averages.
c. Instantiate the array with size CLASS_SIZE.
5.Write a code fragment to do the following tasks:
a.Declare a one-dimensional intarray named birdSightings.
b.Instantiate the array with 20 components.
6.Given the declarations
final intSIZE = 100 ;
int[] count = new int[SIZE];
write code fragments to perform the following tasks:
a.Set countto all zeros.
b.Read values into the array.
c. Sum the values in the array.
7.What is the output of the following code fragment? The input data for the code
are given below it.
int[] a = new int[ 100 ];
int[] b = new int[ 100 ];
intj;
intm;
intsumA = 0 ;
intsumB = 0 ;
intsumDiff = 0 ;
m = Integer.parseInt(inFile.readLine());
for(j = 0 ; j < m; j++)
{
a[j] = Integer.parseInt(inFile.readLine());
b[j] = Integer.parseInt(inFile.readLine());
sumA = sumA + a[j];
sumB = sumB + b[j];
sumDiff = sumDiff + (a[j] – b[j]);
}