Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1 . Write a Java program using the following methods: A method to fill the array with random numbers :the elements of the array should
1. Write a Java program using the following methods:
- A method to fill the array with random numbers: the elements of the array should be random integers between 0 and 100 (declared as class constants).
- A method to print the elements of the array in a table like format (6 elements/line - declared as a class constant)
- A method to find the maximum element in the array
- A method to find the minimum element in the array
Have the size of the array declared as a class constant (30). The methods should take as input parameters the array and its size. The method to print should add one more parameter for the number of elements on each line. Write a program to call these methods and display the difference between the maximum and the minimum element in the array as following.
Sample output: Do you want to start (Y/N): Y The array elements are: 56 90 14 85 39 34 83 81 79 7 63 72 65 56 52 30 91 34 8 23 91 81 63 100 90 22 26 37 13 90 The difference between the max value 100 and the min value 7 = = 93 Do you want to continue (Y/N): y The array elements are: 29 37 46 94 2 13 7 79 91 41 46 23 61 17 55 75 22 30 28 71 71 2 63 52 8 7 83 64 27 24
Step by Step Solution
★★★★★
3.37 Rating (141 Votes )
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