Question: undefined Assignment Objectives After completing this assignment the student should be able to: Declare and instantiate arrays Access array elements by index Use loops and

undefined
Assignment Objectives After completing this assignment the student should be able to: Declare and instantiate arrays Access array elements by index Use loops and decisions to manipulate arrays and array elements Write methods that manipulate arrays Write methods that take array arguments Write methods that return array references Assignment Requirements For this assignment you are given the following files: Assignment06.java (you must complete this file) Problem Description and Given Info Within the Assignment06.java file, you must define the following methods. In the main method, you may write any code that wish to test the methods you have been asked to define. 4) Write a public static method named getAllButlast, that takes an Array of int as an argument and creates and returns a new array with all of the values in the argument array except the last value. For example, given the following Array declaration and instantiation: int[] myArray = {1, 22, 333, 400, 5005, 9}; getAllButLast(myArray) will return an Array of int with these values {1, 22, 333, 400, 5005} 5) Write a public static method named countlessThan, that takes two arguments. The first argument is an Array of int, and the second argument is an int. This method will return (as an int) a count of the number of elements in the argument array that are less than the value of the second argument. For example, given the following Array declaration and instantiation: int[] myArray = {1, 22, 333, 400, 5005, 9}; countless Than(myArray, 333) will return 3 6) Write a public static method named countBetween, that takes three arguments. The first argument is an Array of int, the second and third arguments are both of type int (you can safely assume that the second argument value will always be less than or equal to the third argument value). This method must return (as an int) a count of the number of elements in the argument array that are greater than or equal to the second argument value, and less than or equal to the value of the third argument. For example, given the following Array declaration and instantiation: int[] myArray = {1, 22, 333, 400, 5005, 9}; countBetween(myArray, 20, 400) will return 3 7) Write a public static method named swapByIndex, that takes three arguments. The first argument is an array of double, and the second and third arguments are int indexes. This method will swap the values at the two given index arguments in the array, and return a reference to the array. This method will not create a new Array. It will swap the elements in the argument array and return the argument array. For example, given the following Array declaration and instantiation: double[] myArray = {1.0, 2.2, 33.3, 40.0, 50.05, 9.@}; swapBy Index(myArray, 1, 4) will return the Array with the values (1.0, 50.05, 33.3, 40.0, 2.2, 9.0}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
