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
Artist 52 [7]
2 years ago
9

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:
lina2011 [118]2 years ago
8 0

Answer: 40, 4

Explanation:

You might be interested in
1. Name the three kinds of Eraser in Photoshop. <br>​
antiseptic1488 [7]

Answer:

the Eraser, Background Eraser, and Magic Eraser.

Explanation:

the Eraser, Background Eraser, and Magic Eraser.

5 0
2 years ago
Read 2 more answers
What type of font color should Kim select if she chooses a dark-colored design theme for her presentation?
Gnesinka [82]

ANSWER: Kim has chosen a dark-colored design theme for her presentation. She should therefore choose <u>a bright </u> font color that will <u>contrast with  </u>the background color.

5 0
3 years ago
Read 2 more answers
One benefit of taking notes in class is that the student
MrMuchimi

Answer:

A

Explanation:

you got to listen if you want to be smart

4 0
2 years ago
What type of platform is SAP?
Alex787 [66]
SAP is a data and business processing platform.
7 0
3 years ago
Mica's creating his web page with a software that is free of charge for the first month. If he likes the program, he will have t
Katarina [22]
The answer is C. Shareware
4 0
3 years ago
Read 2 more answers
Other questions:
  • I need help please?!!!
    15·1 answer
  • for what reason do some security professionals consider insiders more dangerous than outside intruders?
    8·1 answer
  • Write the definition of a function printAttitude , which hasan int parameter and returns nothing. The function prints amessage t
    13·1 answer
  • In C++ Please :
    6·1 answer
  • 2) Search the Web for two or more sites that discuss the ongoing responsibilities of the security manager. What other components
    15·1 answer
  • Who created apple and in what year was it created
    9·2 answers
  • bryce's computer is acting unusually sluggish today he calls you an it techniician to see if you can find out what is going on a
    14·1 answer
  • Is there a way to earn free robux
    7·2 answers
  • A connection between files that allows data to be transferred from one file to another is a _______________________.
    6·1 answer
  • (b) In Scratch, the instruction 'when I receive' enables us to _____ the action of multiple sprites ​
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!