1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
brilliants [131]
3 years ago
13

Write a function named findmax()that finds and displays the maximum values in a two dimensional array of integers. The array sho

uld be declared as a 10 row by 15 column array of integers in main()and populated with random numbers between 0 and 100.
Computers and Technology
1 answer:
Kazeer [188]3 years ago
3 0

Answer:

import java.util.*;

public class Main

{

public static void main(String[] args) {

    Random r = new Random();

    int[][] numbers = new int[10][15];

   

    for (int i=0; i<10; i++){

        for (int j=0; j<15; j++){

            numbers[i][j] = new Random().nextInt(101);

        }

    }

   

    for (int i=0; i<10; i++){

        for (int j=0; j<15; j++){

            System.out.print(numbers[i][j] + " ");

        }

        System.out.println();

    }

   

    findmax(numbers);

}

public static void findmax(int[][] numbers){

    int max = numbers[0][0];

   

    for (int i=0; i<10; i++){

        for (int j=0; j<15; j++){

            if(numbers[i][j] > max)

                max = numbers[i][j];

        }

    }

    System.out.println("The max is " + max);

}

}

Explanation:

*The code is in Java.

Create a function called findmax() that takes one parameter, numbers array

Inside the function:

Initialize the max as first number in the array

Create a nested for loop that iterates through the array. Inside the second for loop, check if a number is greater than the max. If it is set it as the new max

When the loop is done, print the max

Inside the main:

Initialize a 2D array called numbers

Create a nested for loop that sets the random numbers to the numbers array. Note that to generate random integers, nextInt() function in the Random class is used

Create another nested for loop that displays the content of the numbers array

Call the findmax() function passing the numbers array as a parameter

You might be interested in
What would be a situation in which you could use an Excel chart to present your data?
Minchanka [31]
The second one is correct
5 0
3 years ago
Read 2 more answers
Which is the best practice for placing graphics on a slide?
lbvjy [14]
All the choices depend on the slide and the last one is a must. the first one should be for the introduction and conclusion and the second one should be used to make ideas conveyed in the presentation easier to understand.
5 0
4 years ago
Read 2 more answers
What are HITs????????
nasty-shy [4]

It is namely an internet made by someone...

8 0
4 years ago
How to know if someone read your message android?
vredina [299]
Is it on the actual messages or on an app???
4 0
4 years ago
1. What is a database?
DENIUS [597]

Answer:

<h2>1. In computing , a database is a organization collection of data </h2><h2>stored at accessed electronically from a computer system .</h2>

5 0
3 years ago
Other questions:
  • The likelihood of the occurrence of a vulnerability multiplied by the value of the information asset - the percentage of risk mi
    12·1 answer
  • Use the image above to determine which toolbars will be displayed in the program you are using. SELECT ALL THAT APPLY
    11·2 answers
  • To implement the various placement algorithms discussed for dynamic partitioning (see Section 7.2 ), a list of the free blocks o
    11·1 answer
  • Database users who access data only through application programs are called
    9·1 answer
  • Each year, Doritos sponsors a Crash the Super Bowl contest, encouraging individuals to submit ads for Doritos to the contest. Th
    11·1 answer
  • to _________________________ is a mouse operation in which you move the mouse until the pointer on the desktop is positioned on
    7·1 answer
  • If you are writing an algorithm and you aren’t confident that you understand the problem, what can you do?
    7·1 answer
  • Drag each tile to the correct box.
    8·1 answer
  • Is it a way to get robuc 4 free
    6·2 answers
  • Which of the following are safety guidelines when socializing online?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!