a) Create a method named printMatrix(). This method accepts a 2D array of integers and prints it in a structured
This problem has been solved!
Do you need an answer to a question different from the above? Ask your question!
Question:
it in a structured table format.
b) Construct a method named findStats(). This method should process a 2D array of integers
and determine both the maximum and minimum values contained within it. The method
should return these two values.
c) Generate a 2D array of integers (the size is at your discretion) filled with random numbers
and apply your methods to this array.
2. Write the following program: Create multiple versions of a method, countEven(), to count the
even numbers from different types of input.
a) Method 1 accepts three integers as parameters and prints the count of even numbers to
the console.
b) Method 2 accepts a 1D array of integers and prints the count of even numbers to the
console.
c) Method 3 accepts a 2D array of integers and returns the count of even numbers to the
caller.
d) Validate each countEven() method with the provided test cases:
countEven(5, 7, 10);
countEven(8, 2, 7);
countEven(new int[]{5, 7, 3, 9, 0});
countEven(new int[]{2, 6, 4, 8, 1});
countEven(new int[][]{{1, 2}, {3, 4, 5}});
countEven(new int[][]{{6, 2}, {3, 4, 0}});
Related Book For
Microsoft Excel Data Analysis And Business Modeling
ISBN: 9780137613663
7th Edition
Authors: Wayne Winston
View Solution
Create a free account to access the answer
Cannot find your solution?
Post a FREE question now and get an answer within minutes.
* Average response time.
Question Details
Chapter #
43
Section: Problems
Problem: 9
Posted Date: September 30, 2023 10:23:53