Answered step by step
Verified Expert Solution
Question
1 Approved Answer
a) Create a method named printMatrix(). This method accepts a 2D array of integers and prints it in a structured table format. b) Construct a
a) Create a method named printMatrix(). This method accepts a 2D array of integers and prints
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}});
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}});
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Solution a Create a method named printMatrix This method accepts a 2D array of integers and prints i...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