Write a method in your class called reversearray that is of


Array Exercises

Create a class named ArrayExercises that contains the following array tasks in the main method:

1. Write some code that asks the user to enter an integer via the keyboard, use that integer to set the length of an array and populate it with random integers from -17 to 19 (inclusive). Print the array back in a nice way (10 numbers per line with commas and such);

2. Below that write some java to reverse the arrays:

char[] a = {'t', 'o', 'y', 'o', 't', 'a'} char[] b = {'r', 'a', 'c', 'e', 'c', 'a', 'r'}

You should do this by creating new arrays to store the reversal. Then write some more java code to prove to me that array b contains a palindrome, while array a does not.

3. (Challenge:) Write a method in your class called reverseArray that is of void return type and it takes as argument a String array (any String array the teacher can think of!) and it reverses the given array in place. That is, it manipulates the given array and modi?es it (this is because arrays are passed in to methods by reference and not by value.

Solution Preview :

Prepared by a verified Expert
Data Structure & Algorithms: Write a method in your class called reversearray that is of
Reference No:- TGS02383968

Now Priced at $40 (50% Discount)

Recommended (96%)

Rated (4.8/5)