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 is the basic process of programming?
NikAS [45]

Answer:

There are usually three stages to writing a program: Coding. Compiling. Debugging.

8 0
2 years ago
In an attack known as ____, valid protocol packets exploit poorly configured dns servers to inject false information to corrupt
ladessa [460]

This is known as DNS poisoning, so called because it 'poisons' the entries of the DNS with false information.

8 0
3 years ago
When entering a function or formula in a cell, which of the first character you must type?
lions [1.4K]
When entering a function or formula in a cell, which of the first character you must type =
3 0
3 years ago
Read 2 more answers
What is pure substance ​
nlexa [21]

Answer:

i don't know

Explanation:

I don't understand

4 0
2 years ago
Which program is commonly used to verify a new piece of hardware?
NeX [460]
<span>In the current software market, the most commonly used desktop operating systems fall into three groups: Microsoft Windows, Apple Mac OS, and Linux. Before upgrading the operating system, check the minimum hardware requirements of the new OS to ensure that it can be installed successfully on the computer. </span>
6 0
3 years ago
Other questions:
  • Explain what mistake Miranda made in the following scenario. Situation: Miranda suspects that there may be a problem with the ha
    13·2 answers
  • Write a program in c or c++ to perform different arithmeticoperation using switch statement .the program will take two inputinte
    10·1 answer
  • What are the pros and cons of editorial anonymity in Wikipedia
    10·2 answers
  • Ross has to create a presentation for his class but can't decide on a topic. What should he do?
    14·2 answers
  • Create a class named CarRental that contains fields that hold a renter's name, zip code, size of the car rented, daily rental fe
    13·1 answer
  • Ten members of a wedding party are lining up in a row for a photograph.
    8·1 answer
  • 0111101101010110101110110001001011101001011101101010101010110101
    14·1 answer
  • can somebody tell me what straykids 2021 collab is gonna be with because i think its gonna be with blackpink
    9·2 answers
  • Select all correct statements below: Group of answer choices A redundant link's switch port will be blocked by STP until needed.
    6·1 answer
  • Carlos had 194 seeds and 11 flower pots he put the same number of seeds in each flower pot which is the best estimate for the nu
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!