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]
2 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]2 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
helppppp asap!!!!!!!!!! Sara has just started using the Internet. She would like to be a little more efficient. In 3–4 sentences
Artist 52 [7]
Use the web for educational purposes.
Use the web for instructional reasons.
Use the web only when something you find interesting does not make sense to you.
Don’t use the web on a day to day basis.
4 0
3 years ago
Read 2 more answers
Rerouting traffic using arp poisoning is an attack on ________ of a network.
Arada [10]
Rerouting traffic using ARP poisoning is an attack on both the functionality  and confidentiality of a network. This is also known as ARP spoofing. This type of attack takes a legitimate IP address of another host and causes traffic redirection to an infected page. 
5 0
3 years ago
Someone is retiring next year. What would be an appropriate amount of risk to take their investments?
slamgirl [31]
B...............................
7 0
2 years ago
Read 2 more answers
Given main() and a base Book class, define a derived class called Encyclopedia. Within the derived Encyclopedia class, define a
alexandr1967 [171]

Answer:

..

Explanation:

i dont really know. I am just answering for the sake of points lol

8 0
2 years ago
PLEASE HELP ME I WILL GIVE BRAINIEST AND 40 POINTSPython Project Worksheet
Paha777 [63]

Answer:

i can only give you pseudocode my fren

Explanation:

# information about me

def main():

MyName =  “malaki”

print(myName)

myInfo = “I was born in wichita, Kansas U.S. I live in japan. I love hotdogs.”

print(myInfo)

main()

sorry if this did not help :( i tried

6 0
2 years ago
Other questions:
  • To move to the bottom of a document window, press the ____ key(s). ALT CTRL PAGE DOWN CTRL PAGE DOWN ALT PAGE DOWN PAGE DOWN
    11·1 answer
  • The True Confessions of Charlotte Doyle begins with what is called a(n) _____.
    15·1 answer
  • 5. Drawing Conclusions If you were a person in
    10·1 answer
  • To check if your operating system is up to date, click Start then click Control Panel and choose _______________. Select one: a.
    11·1 answer
  • I love my baby boy and can someone help me with this
    6·1 answer
  • Learning how to use software takes time. So, after customers have learned to use a particular software package, it is easier to
    11·1 answer
  • What is a cloud in the world of computing
    7·1 answer
  • What is assembler? What is Compiler?What is interpreter?
    9·2 answers
  • How many atoms of oxygen in 4 molecules of HN03​
    12·1 answer
  • Which directory stores the cron configuration file?.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!