Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Java Program Online yperlink mt Cs CenHelader Froat Video reference Number Box P

ID: 3704033 • Letter: J

Question

Java Program

Online yperlink mt Cs CenHelader Froat Video reference Number Box Parts Cap Media Links CommentsHeader & Footer Text Lab Implement the following methods: double min (doublell[ mat) Which will return the minimum value found in the given 2d array. double max (doubleLl mat) Returns the maximum value found in the given 2d array In your main method use an initializer list to create a multidimensional array with the foilowing contents: 90 80 17 26 59 Call min from main, passing in this array. Print the result. Call max from main, passing in this array. Print this result. Expected output: Max i mam 12 ewsonic

Explanation / Answer

DoubleMinMax.java

public class DoubleMinMax {

public static void main(String[] args) {

double mat[][] = {{90,80,17},{26,59,125},{-50,64,32}};

System.out.println("Minimum: "+min(mat));

System.out.println("Maxiimum: "+max(mat));

}

public static double min(double[][] mat) {

double min = mat[0][0];

for(int i=0;i<mat.length;i++) {

for(int j=0;j<mat[i].length;j++) {

if(mat[i][j] < min){

min=mat[i][j];

}

}

}

return min;

}

public static double max(double[][] mat) {

double max = mat[0][0];

for(int i=0;i<mat.length;i++) {

for(int j=0;j<mat[i].length;j++) {

if(mat[i][j] > max){

max=mat[i][j];

}

}

}

return max;

}

}

Output:

Minimum: -50.0
Maxiimum: 125.0

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote