subject

1. Complete the following program so that it computes the maximum and minimum of the elements in the array. Write the program so that it works even if the dimensions of the rows and columns are changed. (Use length rather than hard-coded numbers.) Think carefully about how max and min should be initialized. Debug your program by editing the array. Change it in unexpected ways, such as all negative values, or the largest element as the last, or first, or all elements the same.
import java. io.* ;
class ArrayMaxMin
{
public static void main ( String[] args )
{
int[][] data = { {3, 2, 5},
{1, 4, 4, 8, 13},
{9, 1, 0, 2},
{0, 2, 6, 3, -1, -8} };
// declare and initialize the max and the min
???
//
for ( int row=0; row < data. length; row++)
{
for ( int col=0; col < ???; col++)
{
???
}
}
// write out the results
System. out. println( "max = " + max + "; min = " + min );
}
}
2. Modify the program so that it computes and prints the largest element in each row.
Requirements: Looping, bounds checking, initializer lists.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 02:00
Aisha has finished working on a word processing document that contains 15 pages. she has added some special elements in the first three pages, page 9 and 10, and page 15 from the document. she wants to print only these pages to see how they look. which option is the correct way to represent (in the print dialog box) the pages that aisha wants to print?
Answers: 1
question
Computers and Technology, 22.06.2019 19:00
In he example code, what does the title attribute create? a tool tip an element a source a markup
Answers: 1
question
Computers and Technology, 25.06.2019 01:30
Why is the most liked picture on instagram an eggy? owo
Answers: 1
question
Computers and Technology, 25.06.2019 11:10
Plato: which view of report creation allows you to customize the report before the database program creates it?
Answers: 3
You know the right answer?
1. Complete the following program so that it computes the maximum and minimum of the elements in the...
Questions
question
English, 05.05.2021 17:40
question
Biology, 05.05.2021 17:40
question
Mathematics, 05.05.2021 17:40
question
Mathematics, 05.05.2021 17:40