Question: Java program help please Create a main method, and create a 2D integer array called data , with a size of five (5) by five

Java program help please

  1. Create a main method, and create a 2D integer array called data, with a size of five (5) by five (5). Ask the user to input the values for this array (Scanners nextInt).

  1. Create a method called LongestPositiveSeries, that takes in a 2D array and finds the length of the longest continuous series of positive numbers in it.
    • For example, if we had an array like this:

0

1

2

3

4

5

-1

-5

-5

5

3

-2

56

25

-15

0

5

5

0

324

46

25

0

0

0

  • The length would be 5. For this problem, 0 is considered non-negative and not positive, so we start counting from index [0, 1] (which is 1) to [1, 0] (which is 5) and end at index [1, 1] (which is 1).

  • Hint: Consider using a basic linear search and modifying it to keep track of the current positive streak of numbers.

  1. Call that method in your main, for the array data.

4. Print out the returned result from your method in your main, along with the content of data.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!