Exercise 2: Write array methods that carry out the following tasks for an array of integers by creating and completing the “ArrayMethods" class below. Add documentation comments for each method....


Exercise 2:<br>Write array methods that carry out the following tasks for an array of integers by creating and<br>completing the “ArrayMethods

Extracted text: Exercise 2: Write array methods that carry out the following tasks for an array of integers by creating and completing the “ArrayMethods" class below. Add documentation comments for each method. Provide a test program called 'Lab5_yourID.java" that tests methods of ArrayMethods class. In your test program, use random class to generate array values. public class ArrayMethods { private int[] values; //declare instant variables public ArrayMethods (int[ ] initialValues) {values = initialValues;} //constructor public void shiftRight( ) { … } ... public boolean ad jacentDuplicate( ) {…) Method shiftRight: that shifts all elements by one to the right and move the last element into the first position. For example, 1 49 16 25 would be transformed into 25 1 4 19 16. Method ad jacentDuplicate: returns true if the array has two adjacent duplicate elements.

Jun 10, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here