Question: 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
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 adjacent Duplicate() ... Method shiftright: that shifts all elements by one to the right and move the last element into the first position. For example, 1 4 9 16 25 would be transformed into 25 1 4 19 16. Method adjacentDuplicate: returns true if the array has two adjacent duplicate elements
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
