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
AnnZ [28]
3 years ago
11

Find the maximum value and minimum value in below mention code. Assign the maximum value to maxMiles, and the minimum value to m

inMiles. Sample output for the given program:
Min miles: -10
Max miles: 40
Here's what I have so far:

import java.util.Scanner;

public class ArraysKeyValue {
public static void main (String [] args) {
final int NUM_ROWS = 2;
final int NUM_COLS = 2;
int [][] milesTracker = new int[NUM_ROWS][NUM_COLS];
int i = 0;
int j = 0;
int maxMiles = 0; // Assign with first element in milesTracker before loop
int minMiles = 0; // Assign with first element in milesTracker before loop

milesTracker[0][0] = -10;
milesTracker[0][1] = 20;
milesTracker[1][0] = 30;
milesTracker[1][1] = 40;

//edit from here

for(i = 0; i < NUM_ROWS; ++i){
for(j = 0; j < NUM_COLS; ++j){
if(milesTracker[i][j] > maxMiles){
maxMiles = milesTracker[i][j];
}
}
}
for(i = 0; i < NUM_ROWS; ++i){
for(j = 0; j < NUM_COLS; ++j){
if(milesTracker[i][j] < minMiles){
minMiles = milesTracker[i][j];
}
}
}

//edit to here


System.out.println("Min miles: " + minMiles);
System.out.println("Max miles: " + maxMiles);
}
Computers and Technology
1 answer:
Kobotan [32]3 years ago
3 0

Answer:

Code works perfectly

Explanation:

There is nothing wrong with your program as it runs perfectly and displays the expected results.

You may need to compile with another compiler if you're not getting the required results.

I've added the source code as an attachment (unedited)

Download java
You might be interested in
When can screentips be useful? when finding a tab when looking for a command when pinning the ribbon when using a command.
Anettt [7]

Screentips be useful when looking for a command.

<h3>What are Screentips?</h3>

These are referred to small windows which displays descriptive text when the pointer is rested on a command and it is usually done using the mouse.

Screentips is therefore useful when an individual is looking for a command as a result of the information derived from the descriptive texts.

Read more about Screentips here brainly.com/question/18955460

6 0
3 years ago
How to transfer music from computer to iphone?
vladimir1956 [14]
Depends on how you wanna do it, through iTunes or whatever other you are syncing from
8 0
3 years ago
True or false: when considering data backups, it is most important to verify that the integrity of the backup file or data is va
Alika [10]

your correct answer is true

5 0
3 years ago
What can help you best learn about appearance, habitats and behaviors of birds in your area
Korvikt [17]

c microbiology textbook

8 0
3 years ago
Which of the following are picture adjustments that can be made to images?
Masteriza [31]

Answer:

D - All of the above

Explanation:

8 0
3 years ago
Read 2 more answers
Other questions:
  • Choose the answer that best explains why Morse's invention of the telegraph changed media forever.
    11·2 answers
  • What is the difference between HTML and CSS? * 1. CSS is a markup language unlike HTML. 2. HTML is a backend technology and CSS
    12·2 answers
  • Which camera options shows time to be slowly
    5·1 answer
  • Given a String variable named line1 and given a Scanner reference variable stdin that has been assigned a reference to a Scanner
    11·1 answer
  • In what tab can a user find the workspace option?
    8·1 answer
  • Who wants brainliest? First to answer gets it....
    12·2 answers
  • Digital computers use a........ system to encode date and programs.<br>​
    8·1 answer
  • Which of the following is NOT true about a USB stick?
    5·2 answers
  • Who are all the fnaf characters?
    7·1 answer
  • You are an administrator of a growing network. You notice the network you have created is broadcasting, but you cannot ping syst
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!