Question: Java Write a program in which the main method creates an array with 10 slots of type int. Assign to each slot a randomly-generated integer.
Java Write a program in which the main method creates an array with 10 slots of type int. Assign to each slot a randomly-generated integer. Call a function, passing it the array. The called function should RETURN the largest integer in the array to your main method. Your main method should display the number returned. Use a Random object to generate integers. Create it with Random r = new Random(7); Generate a random integer with x = r.nextInt(); 7) Same as question 6, but the called function should return the last number in the array. Do not assume the passed array has ten slots. It should work for an array of any size.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
