Question: You are to write an application ( application is used here to mean program ) called ListMethods.java that does some useful things with

You are to write an application ("application" is used here to mean "program") called ListMethods.java that does some useful things with arrays. In addition to the getInfo() method, your program should have the following methods.
public int findMin() that accepts a one-dimensional array as a parameter and returns the smallest value in the array. If the array is empty (size 0) it returns Integer.MIN_VALUE.
public int findMinIndex() that accepts a one-dimensional array as a parameter and returns the index of the smallest value in the array. If the array is empty (size 0) it returns -1.
public void reverse() that accepts a one-dimensional array as a parameter and reverses order of the array values. Hint: there are two approaches to this: (1) swap the array values--but stop half way or you'll swap them back to their original position, or (2) create a new array and copy the values into it in the reverse order from the original array, then copy the new reversed array back into the original array.
public boolean shiftUp() that accepts a one-dimensional array as a parameter and moves all values in the array from their current index to current index minus 1. Note that the value in position 0 is overwritten. The highest index is not overwritten (i.e., the value at array[array.length-1] will be duplicated in array[array..length-2]. The method should return true unless the array size is zero.
public boolean shiftDown() that accepts a one-dimensional array as a parameter and moves all values in the array from their current index to current index plus 1. Note that the value in array[array.length-1] is overwritten. The lowest index is not overwritten (i.e., the value at array[0] will be duplicated in array[1]. The method should return true unless the array size is zero.

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!