Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C# Code please with picture of code.Thanks! 1. Create a Main method, and create a 2D integer array called data , with a size of
C# Code please with picture of code.Thanks!
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)
- 2.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.
- 3. 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.
- C# CODE
Step by Step Solution
There are 3 Steps involved in it
Step: 1
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