Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Object Oriented Programming Java Programming Exercises 2023 [Question1] Rreverse an array Write a program that reverses a random generated integer array. You shoulde define 3
Object Oriented Programming Java Programming Exercises 2023 [Question1] Rreverse an array Write a program that reverses a random generated integer array. You shoulde define 3 methods: 1. Method int [] createArray () The purpuse of this method is to generate 20 integer numbers randomly between ( 0 and 100) and assigns them to an array. - The created array must be returned in order to reverse it by the second method. - You can obtain a random integer numbers by using nextInt () method in the Random class. - You should pass the upper bound to the nextint () method to generate values in the specified range. Example: int [] X= new int [1]; Random rd = new Random(); // generates random numbers in the range 0 to 99 x[0]=rd. nextInt (100); 2. Method int [] reverseArry (int [] oriqinalArray) The purpuse of this method is to reverse the passeed array and return it after reverse. 3. Method displayArray(int [] arraytoDisplay) This method accept an array and display it. Write a test program that call createArray() method to generat a random array of integers, then pass it to the reverseArray() method, and display the reverserd array by calling the reverseArray() method. Here is the sample run of the program
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started