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
MakcuM [25]
3 years ago
6

Find the maximum value and minimum value in milesTracker. Assign the maximum value to maxMiles, and the minimum value to minMile

s. 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:
Ann [662]3 years ago
7 0

Answer:

See Explanation

Explanation:

Your program is correct and doesn't need an attachment.

However, there's a mismatch in placement of curly braces in your program

{

}

I've made corrections to that and I've added the corrected program as an attachment.

Aside that, there's no other thing to be corrected in your program.

Use another compiler to compile your program is you are not getting the required output.

Download java
You might be interested in
Who is willam afton from five nights at freddy
diamong [38]

Answer:

the man behind the murder

8 0
3 years ago
Read 2 more answers
Which operating system is used by most the supercomputer system in the world
DENIUS [597]

Answer:

Linux

Explanation:

Linux runs all of the top 500 supercomputers

3 0
2 years ago
A chain of dry-cleaning outlets wants to improve its operations by using data from
kotykmax [81]
A










explanation cause it is
5 0
3 years ago
Hi i choose brainlyest 4 free
irinina [24]

Answer:

bet

Explanation:

7 0
3 years ago
Read 2 more answers
A ____ is text and graphics that print at the top of each page
Volgvan
It would probably be the header.
3 0
3 years ago
Other questions:
  • How do i start makeing a Character in the Unreal Game Engine
    14·2 answers
  • Points Possible: 6, Points Correct: 4
    6·1 answer
  • HELP ASAP ILL DO ANYTHING
    6·1 answer
  • Based on the type of document you want to create, you must first select the page
    15·2 answers
  • The three devices you are going to install are a 2u server, a 1u keyboard tray, and an 8u space for a rack mounted moitor. Given
    6·1 answer
  • Heelo how do u do python syntax lesson 11 on code academy
    12·1 answer
  • The advantage of an electronic ____ is that the content can be easily edited and updated to reflect changing financial condition
    8·1 answer
  • Dell Computers is a nationally recognized manufacturer of computers for the small business and home markets. If Dell were to ord
    9·1 answer
  • How do you think someone has programmed computer calculator?​
    13·1 answer
  • Whats the highest rank in brainly
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!