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]
3 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]3 years ago
8 0

Answer: 40, 4

Explanation:

You might be interested in
The hottest part of the Earth is the
Troyanec [42]
C. Mantle would be correct
3 0
3 years ago
Read 2 more answers
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
....................................................................................................
r-ruslan [8.4K]

Answer:

......................

..............

......

....

...

..

.

6 0
2 years ago
How can I make [ print(3 * x) ] into a functional python code?
CaHeK987 [17]

If you're programming in python, you simply have to assign a value to x and then use the print function. For instance,

x = 3

print(3 * x)

9 will be the output. I hope this helps!

5 0
3 years ago
During which geologic era was nearly all of Earth's land concentrated into one giant mass called Pangaea?
Scorpion4ik [409]
The answer would be Mesozoic.
HOPE THIS HELPS YOU! ^_^
6 0
3 years ago
Other questions:
  • If a user wants to change one small section of the formatting of a document and leave the rest the same, which process should be
    14·1 answer
  • What does an approved project summary document indicate?
    13·1 answer
  • What should be included as part of the approval process? in relation to computer forensics
    14·1 answer
  • What do these terms have in common? google, yahoo!, bing they are important books. they are internet search engines. they are wo
    10·1 answer
  • Stating a document is PDF or XPS document refers to document _______​
    10·1 answer
  • Can someone tell me? I have an assignment in C++: I have to do three codes please tell me should i do them in one project or in
    12·1 answer
  • Problem: Mr. James Reid, the director of admissions at MOGCHS University, has
    14·1 answer
  • Guess The Song:
    9·1 answer
  • If your cell phone rings while you are driving and you do not have a hands-free device you should
    9·1 answer
  • What is a simple definition for electricity?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!