Question
Part 2 Array Operations For this part of the lab, you'll be writing methods to work with 1D arrays. _ Add a new java class
Part 2 Array Operations For this part of the lab, you'll be writing methods to work with 1D arrays. _ Add a new java class to your existing folder. _ Put your name as a comment on the top of the class. _ You will be generating random numbers so import java.util.Random. _ You should consider developing the methods for this project incrementally. _ In main, use an initializer list create an array of ints called nums holding the following values: 1, 4, 13, 43, -25, 17, 22, -37, 29 _ Write a method, called findLargest, that returns the largest value in the array and have the client print the result _ Create an int array of size 20, called data and write a method to fill the array with random ints [-100, 100]. Recall that randoms nextInt( x) method returns a value from 0 to x- 1. The upper bound is exclusive. Modify the values to fit the required ranges. _ Use the findLargest method you previously wrote to return the largest value in data for the client to print _ Print the sum of the largest values from nums and data _ Print the contents of data. _ Find the length of the longest continuous series of positive numbers in the array data. If the contents were: 4 5 0 2 . . . -1 88 78 66 -6. The length would be 3. For this problem, 0 is considered non-negative but not positive.
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