Question: make the java class FinalQ1. your code will be written in this one single class called FinalQ1. in this question, you will instantiate an array

make the java class FinalQ1. your code will be written in this one single class called FinalQ1. in this question, you will instantiate an array of integers and write two methods to preform two different operations on the array. the two methods you will write are limitMax and removeLeadingZeros. each method is explained below. the first method is the limitMax method which will take in an integer as an argument and change any value in the integer array that has an absolute value greater than the argument integer to the argument integer. here is an example: int[] initialArray = {0, 0, 0, 45, -35, 0, 120, 0, -2000, 0, 4, -387, 0, 0,} after the call to limitMax(100), the returned array is: int[] limitMaxArray = {0, 0 ,0, 45, -35, 0, 100, 0, -100, 0, 4, -100, 0, 0} in the returned array limitMaxArray, every value has an absolute value of 100 or less. after the call to limitMax(50), the returned array is: int[] limitMaxArray = {0, 0, 0, 45, -35, 0, 50, 0, -50, 0, 4, -50, 0, 0} in the returned array limitMaxArray, every value has an absolute value of 50 or less. after the call to limitMax(10), the returned array is: int[] limitMaxArray = {0, 0, 0, 10, -10, 0, 10, 0, -10, 0, 4, -10, 0, 0} in the returned array limitMaxArray, every value has an absolute value of 10 or less. instructions for limitMax array: - make the method static - take in integer as an argument - return the integer array limitMaxArray the second method you will write is removeLeadingZeros. this method will remove only leading zeros. non-leading zeros are left intact. here is an example: int[] initialArray = {0, 0, 0, 45, -35, 0, 120, 0, -2000, 0, 4, -387, 0, 0} after the call to removeLeadingZeros, the returned array is: int[] removeLeadingZerosArray = {45, -35, 0, 120, 0, -2000, 0, 4, -387, 0, 0} in the returned array removeLeadingZerosArray, all leading zeros have been removed but non-leading zeros are not removed. also, the size of the returned array is different from that of the initial array. instructions for making the removeLeadingZeros method: - make the method static - return the integer array removeLeadingZerosArray

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!