Respuesta :
Answer:
See Explanation
Explanation:
The line by line explanation of the modified program is as follows:
(1)
min is declared and initialized to the highest possible integer and max is declared and initialized to the least possible integer
int min,max;
min = Integer.MAX_VALUE; max = Integer.MIN_VALUE;
This iterates through each row. Because each row has a different number of elements, the row length of each is calculated using data[row].length
for ( int [tex]col=0; col[/tex]< [tex]data[row].length[/tex]; col++){
The following if statements get the minimum and the maximum elements of the array
if(data[row][col] < min){ [tex]min = data[row][col];[/tex] }
if(data[row][col] > max){ [tex]max = data[row][col];[/tex] }
(2):
The loop remains the same, however, the print statement is adjusted upward to make comparison between each row and the highest of each row is printed after the comparison
for ( int [tex]row=0; row[/tex] < [tex]data.length;[/tex] row++){
for ( int [tex]col=0; col[/tex]< [tex]data[row].length;[/tex] col++){
if(data[row][col] > max){ [tex]max = data[row][col];[/tex] }
}
System.out.println( "max = " + max);
max = Integer.MIN_VALUE; }
See attachment for complete program that answers (1) and (2)