Question: Java Write a program to manipulate arrays. (1) Write a subprogram that asks the user for the size of a list of real numbers (use

Java

Java Write a program to manipulate arrays. (1) Write a subprogram that

Write a program to manipulate arrays. (1) Write a subprogram that asks the user for the size of a list of real numbers (use 'double'), then allocates an array of that size, and then repeatedly asks the user for each number and stores it in the next element of the array. Return the new array to the calling function (using the 'return' statement). (2) Write a subprogram that is given an array of numbers and a given threshold. Scan the array for numbers that are greater than the given threshold (a 'double') and create an array of the indexes of those entries. Start by scanning the array of numbers and count the number that are greater than the threshold. Then allocate an array of integers of that size. Finally, scan the array of numbers again and copy the indexes of the entries larger than the threshold to the new array. For example, given the following: search array [ 101, 103, 101, 104, 105, 101, 107 for entries greater than 101 return the following: [1, 3, 4, 6 ] (an array of exactly four elements). If there are no entries greater than the threshold, then return null. Please use the algorithm described in these instructions (3) Write a main program that calls these two subprograms. Ask the user to enter the list of numbers. then repeatedly ask for a threshold and display the indexes of the larger entries until the user decides to stop. Afterwards, ask the user if they want to do it again for another list of numbers, or stop the program

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!