Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Select a signature for each method described below. Do not write the methods! a)

ID: 3596575 • Letter: S

Question

Select a signature for each method described below. Do not write the methods!

a) The method finds the number of times a given value occurs in a given subrange between from (inclusive) and to (exclusive) within an array of integers.

b) The method finds the largest value stored in an array of integers.

c) The method removes every other String from an array of Strings, and stores the results in a newly constructed array.

d) The method puts the elements of an existing array in random order.

e) The method creates an array of int of a given size with randomly generated elements between small (inclusive) and large (exclusive).

Explanation / Answer

a) The method finds the number of times a given value occurs in a given subrange between from (inclusive) and to (exclusive) within an array of integers.

Answer: public int subrange(int a[], int inclusive, int exclusive);

b) The method finds the largest value stored in an array of integers.

Answer: int max(int a[]);

c) The method removes every other String from an array of Strings, and stores the results in a newly constructed array.

Answer: String[] removeString(String s[], String other);

d) The method puts the elements of an existing array in random order.

Answer: void randomOrder(int a[]);

e) The method creates an array of int of a given size with randomly generated elements between small (inclusive) and large (exclusive).

Answer: void createArray(int size, int inclusive, int exclusive);

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote