
(JAVA)
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
Min miles: -10
Max miles: 40
_________________________________
import java.util.Scanner;
public class ArraysKeyValue {
public static void main (String [] args) {
Scanner scnr = new Scanner(System.in);
final int NUM_ROWS = 2;
final int NUM_COLS = 2;
int [][] milesTracker = new int[NUM_ROWS][NUM_COLS];
int i;
int j;
int maxMiles; // Assign with first element in milesTracker before loop
int minMiles; // Assign with first element in milesTracker before loop
for (i = 0; i < milesTracker.length; i++){
for (j = 0; j < milesTracker[i].length; j++){
milesTracker[i][j] = scnr.nextInt();
}
}
/* Your solution goes here */
System.out.println("Min miles: " + minMiles);
System.out.println("Max miles: " + maxMiles);
}
}
![CHALLENGE
10.9.1: Find 2D array max and min.
АCTIVITY
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: -10
Max miles: 40
(Notes)
374934.2421584.qx3zqy7
int maxMiles; // Assign with first element in milesTracker before loop
int minMiles; // Assign with first element in milesTracker before loop
11
12
1 test
passed
13
0; i < milesTracker.length; i++){
for (i
for (j = 0; j < milesTracker[i].length; j++){
milesTracker[i][j]
}
}
14
15
All tests
16
scnr.nextInt();
passed
17
18
19
20
V* Your solution goes here
*/
21
System.out.println("Min miles:
System.out.println("Max miles:
}
+ minMiles);
+ maxMiles);
22
23
24
25 }
Run
View your last submission v
Need help?
Feedback?
Instructor note:
2-Dimensional Arrays Java (19:02)](https://content.bartleby.com/qna-images/question/945892cb-ed29-4ccf-b18f-dab49f1692d9/48d20708-7e09-455e-b29f-d529579b4cd4/0a7li0r_thumbnail.png)
![CHALLENGE
10.9.1: Find 2D array max and min.
АCTIVITY
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: -10
Max miles: 40
(Notes)
374934.2421584.qx3zqy7
1 import java.util.Scanner;
2
1 test
3 public class ArraysKeyValue {
passed
public static void main (String [] args) {
Scanner scnr = new Scanner(System.in);
final int NUM_ROWS
4
All tests
6.
2;
2;
= new int[NUM_ROWS] [NUM_COLS];
passed
final int NUM_COLS
int D] milesTracker
int i;
int j;
int maxMiles; // Assign with first element in milesTracker before loop
int minMiles; // Assign with first element in milesTracker before loop
7
8.
10
11
12
13
0; i < milesTracker.length; i++){
for (j = 0; j < milesTracker[i].length; j++){
milesTracker[i]li]
14
for (i
15
16
scnr.nextInt();
Run
View your last submission v
Need help?
Feedback?
Instructor note:
2-Dimensional Arrays Java (19:02)](https://content.bartleby.com/qna-images/question/945892cb-ed29-4ccf-b18f-dab49f1692d9/48d20708-7e09-455e-b29f-d529579b4cd4/f1lh9r_thumbnail.png)

Trending nowThis is a popular solution!
Step by stepSolved in 3 steps with 2 images

- Java - Help Please How do I output this statement as a horizontal statement with a newline? Everytime I use System.out.println, it makes the entire output vertical instead of horizontal. Program below. import java.util.Scanner; public class LabProgram { public static void main(String[] args) { int x; int y; Scanner scan = new Scanner(System.in); x = scan.nextInt(); y = scan.nextInt(); if(y >= x){ for(int i=x; i<=y; i = i + 5) { System.out.print(i+ " "); (The problem line) } } else{ System.out.print("Second integer can't be less than the first."); } }}arrow_forward8360 انتقال أدوات Q WhatsApp Image 2021-04-18 at 12.37.35 PM.jpeg ramming in Business fall20 A String cannot cross lines in the source code. Thus, the following statement would result in a compile error of public static void main(String[] args) { tion System.out.println("My name is Mohammed and I'11 get an A in java Insha Allah") Select one: O True O False 人arrow_forwardHow do I do this in Java language?arrow_forward
- Use Python code with: "def recolorImage(img,color):" without using cv2 or PIL recolor(img, color) - Changes all non-white pixels of the image referred to by the parameter img to the specified color, and returns a new image with the changes. img is a 2D array of RGB pixels which represent images. color is a list containing 3 integers, each from 0 to 255, representing RGB values. To create a new image use the cmpt120image.getBlackImage() function which returns a new canvas to draw on.arrow_forwardQ2: Order of operations and math data types Use the Java IDE to create and run the following program: // Java program by [Student name] [Today's date] public class MathExample { public static void main(String[] args) { System.out.println(3/2+3); System.out.println(0.5*3+4/2); System.out.println(0.5*2/3+10/2); } } Please answer the following questions. What type of literal is 3: double or Integer? What type of literal is 0.5: double or integer? For the first expression, why is first value printed 4 instead of 4.5? For the second expression, which math operation is done last? Use parentheses to change the third expression so (3+10) is calculated first. Paste the revised expression here: Please give a full explanation of the program. Please keep in mind that I am a beginner and please keep it simple.arrow_forward- Write a program to accept n integer values in an array (array size defined and inputted by the user). Then start showing/printing the existing values in the following format. (Use Java coding language).arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education





