Java Reference
In-Depth Information
23. int sum = 0;
int maxIndex;
int max;
for ( int j = 0; j < 10; j++)
cars[j] = inFile.nextInt();
for ( int j = 0; j < 10; j++)
sum = sum + cars[j];
System.out.println("The total number of cars sold = " + sum);
max = cars[0];
for ( int j = 1; j < 10; j++)
if (max < cars[j])
max = cars[j];
System.out.println("The salesperson(s) selling the maximum "
+ "number of cars: ");
for ( int j = 0; j < 10; j++)
if (max == cars[j])
System.out.print(j + ", ");
System.out.println();
25. One contains: 3 8 13 18 23
Two contains: 5 15 25 35 45 28 33 38 43 48
27. The base address of the array.
29.
a.
30
b.
5
c.
6
d.
row
e.
column
31.
a. beta is initialized to zero.
b.
First row of beta: 0 1 2
Second row of beta: 1 2 3
Third row of beta:
2 3 4
c.
First row of beta: 0 0 0
Second row of beta: 0 1 2
Third row of beta:
0 2 4
d.
First row of beta: 0 2 0
Second row of beta: 2 0 2
Third row of beta:
0 2 0
Search WWH ::




Custom Search