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
Heeeeeeeelp :)<br> thx<br> jfdyiusjmkdsuiho;dmcvrvho;j
anastassius [24]

Answer:

I think option C is correct

7 0
3 years ago
Read 2 more answers
A ____________ is a set of commands which can be run by calling it by name. (Phyton)
Lerok [7]

Answer: script

Explanation:

I haven't done much Computer Science in whichever subject this is, but I'm sure a script is a series of commands!

7 0
3 years ago
Read 2 more answers
Style of music that originated in New Orleans in the early 1900s
Sever21 [200]

Answer:

jazz

Explanation:

7 0
3 years ago
Read 2 more answers
The short-term, 0-24 hours, parking fee, F, at an international airport is given by the following formula:  5, if 0 # h # 3 F5
jek_recluse [69]

The following code will program that prompts the user to enter the num- ber of hours a car is parked at the airport and outputs the parking fee.

<u>Explanation:</u>

Code:

#include<iostream>

using namespace std;

int main()

{

float hours;

cout <<"Enter number of hours a car parked at the airport: "; // prompt the user to enter hours.

cin >> hours ; // strong the hours

if (hours > = 0 && hours < =3 ) // if 0 < = h < = 3

cout << "Parking fee: 5"; //printing parking fee is 5.

else if (hours > 3 && hours < = 9)//if 3 < h < = 9

cout<<"Parking fee: "<<6*int(hours);//converting float value to int the multiplying with 6 then printing fee.

else//if 9 < h < = 24

cout<< "Parking fee: 60";// printing parking fee 60.

return 0;

}

6 0
4 years ago
La computadora es un medio de comunicacion moderno?
kolbaska11 [484]
Moderno = mordern, if It does than yes!
3 0
3 years ago
Other questions:
  • How do I only give 5 points and not 10?
    7·1 answer
  • Which of the following subjects is considered technical education
    11·1 answer
  • A __________ is an entity that manages the use, performance, and delivery of cloud services, and negotiates relationships betwee
    6·1 answer
  • If you need to write a function that will compute the cost of some candy, where each piece costs 25 cents, which would be an app
    5·1 answer
  • Which language is written using 0s and 1S​
    11·1 answer
  • How do i mark answers brainliest on brainly
    11·2 answers
  • Help with Java, please!
    5·1 answer
  • What is the grade, as a percentage with two digits after the decimal point, obtained when you graded this 101-question multiple-
    13·1 answer
  • The data model shows the_______structrue of database.​
    14·1 answer
  • Need help not sure if I’m correct
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!