a) Create a method named printMatrix(). This method accepts a 2D array of integers and prints it
Fantastic news! We've Found the answer you've been seeking!
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
Posted Date: