Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

Question

Please help me with this using java:

/**

* Implement the method below, which takes a two-dimensional array of integers

* as the input argument and returns the total number of <strong>distinct

* pairs</strong> (a, b) where both a and b are even numbers and a is less than

* b ({@code a < b} ). Your code should use nested for loops.

*

* <p>

* For example:

* </p>

*

* <pre>

* if inputarray = { {9, 10, 3, 4, 3}, {1, 6, 2}, {4, 24, 46, 0}, {15, 9, 45, 57} } then return 21

* note we have 21 distinct pairs within this 2D array as follows

* [0, 2],[0, 4],[0, 6],[0, 10],[0, 24],[0, 46],[2, 4],[2, 6],

* [2, 10],[2, 24],[2, 46],[4, 6],[4, 10],[4, 24],[4, 46],[6, 10],

* [6, 24],[6, 46],[10, 24],[10, 46],[24, 46]

* if inputarray = { {1, 6, 1}, {5, 9, 15, 20}, {23, 33, 99} } then return 1

* if inputarray = { {4, 21, 43, 1}, {22, 32, 42, 52} } then return 10

* if inputarray = { {15, 9, 45, 57}, {13, 17, 23} }then return 0

* </pre>

*

* @param inputarray 2D int input array

* @return the number of distinct pairs (a, b) where both a and b are even

* numbers and {@code a < b}.

*/

publicstaticintcountEvenPairs2D(int[][]inputarray){

 

 

/*

* Your implementation of this method starts here. Recall that : 1. No

* System.out.println statements should appear here. Instead, you need to return

* the result. 2. No Scanner operations should appear here (e.g.,

* input.nextInt()). Instead, refer to the input parameters of this method.

*/

 

 

Expert Solution
Check Mark
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education