Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

What is the purpose of the Salary Structure Table?

Answered: 1 week ago

Question

What is the scope and use of a Job Family Table?

Answered: 1 week ago