subject

Find the maximum value and minimum value in milesTracker. Assign the maximum value to maxMiles, and the minimum value to minMiles. Sample output for the given program:Min miles: -10Max miles: 40Here'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); }

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 12:30
An atom's diameter is about 0.1 nanometer (1Γ—10-9m), and a human hair is about 1Γ—10-3m. how many times greater is a human hair than an atom's diameter? sorry pushed wronf button but this is math
Answers: 3
question
Computers and Technology, 23.06.2019 02:00
As with any small island country, cuba has fewer natural resources than countries such as brazil. this affects their economy in that cuba a) exports only manufactured products. b) exports more products than it imports.. c) must import more products than it exports. d) has imposed trade barriers against the united states.
Answers: 3
question
Computers and Technology, 23.06.2019 05:20
Which operating system is a version of linux?
Answers: 1
question
Computers and Technology, 23.06.2019 07:00
You need a quick answer from a coworker. the most effective way to reach your coworker is through a. cloud server b. instant message c. teleconference d. telepresence
Answers: 1
You know the right answer?
Find the maximum value and minimum value in milesTracker. Assign the maximum value to maxMiles, and...
Questions
question
Mathematics, 24.06.2019 22:00
question
Social Studies, 24.06.2019 22:00
question
Mathematics, 24.06.2019 22:00
Questions on the website: 13722361