Question
java coding help 1. Given the following 2D array: String[ ][ ] months=new String[x][y]; Write a line of code that will output the # of
java coding help
1.
Given the following 2D array: String[ ][ ] months=new String[x][y];
Write a line of code that will output the # of columns in the array.
2.
Given the following 2D array: double[ ][ ] values=new double[x][y];
Write a line of code that will output the # of rows in the array.
3.
What does the following mysteryMethod do? public int mysteryMethod() { int total = 0; for (int row = 0; row < matrix.length; row++) { for (int col = 0; col < matrix[0].length; col++) { total = total + matrix[row][col]; } } return total; }
4.
2D Array of Temperatures: int[ ][ ] temps=new int[x][y];
Method Heading: public int[ ] calculateRowSums(int[ ][ ] temps)
Write a method to calculate the sum of each row in the 2D array. The method must work for any size array.
5.
2D Array of Temperatures: int[ ][ ] temps=new int[x][y];
Method Heading: public int findMinTemp(int[ ][ ] temps)
Write a method to find the minimum temperature in the array. The method must work for any size array.
6.
Given: 2D Array of Numbers: int[ ][ ] numbers=new int[x][y];
Method Heading: public int countValue(int[ ][ ] numbers, int value)
Write a method to count the # of times "value" appears in the array.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started