subject

Write a java code to accept an integer array of user-defined length from the user. Then write methods to take care of the following tasks. Check your methods in the main method of your program (3 points). A method that finds the sum of the maximum value and the minimum value among all the elements of the array. (3 points)
Example: 10 15 4 19 2 12
The maximum value is 19 and the minimum value is 2. So the output should be 21.
A method that finds the largest gap between any two elements of the array. (4 points)
Example: 3 6 7 10
The largest gap can be found between 3 and 10 which is 10 - 3 = 7, hence the output 7.
A method that finds the Length of the Longest Arithmetic Progression in it. (5 points)
Example: 1 7 10 15 27 29
The Longest Arithmetic Progression in the array is {1, 15, 29}, and its length is 3, hence the out

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 11:00
Ihave an iphone 8plus should i get another phone like samsung note 9 or s9 ? ?
Answers: 2
question
Computers and Technology, 24.06.2019 15:30
During the software planning process, rick, a project manager, finds that his team has made an incorrect estimation of funds. what kind of risk has rick identified? rick has identified a risk.
Answers: 1
question
Computers and Technology, 25.06.2019 05:00
Arun is 5 years older than anu. five years ago, the ratio of their ages was 3: 2 . find their present age
Answers: 2
question
Computers and Technology, 25.06.2019 09:10
3.12: the speed of sound the speed of sound depends on the material the sound is passing through. below is the approximate speed of sound (in feet per second) for air, water and steel: air: 1,100 feet per second water: 4,900 feet per second steel: 16,400 feet per second write a program class the speed of sound that asks the user to enter “air”, “water”, or “steel”, and the distance that a sound wave will travel in the medium. the program should then display the amount of time it will take. you can calculate the amount of time it takes sound to travel in air with the following formula: time = distance/1,100 you can calculate the amount of time it takes sound to travel in water with the following formula: time = distance/4,900 you can calculate the amount of time it takes sound to travel in steel with the following formula: time = distance/16,400
Answers: 3
You know the right answer?
Write a java code to accept an integer array of user-defined length from the user. Then write method...
Questions
question
Mathematics, 27.06.2019 02:30
question
Mathematics, 27.06.2019 02:30
question
English, 27.06.2019 02:30
Questions on the website: 13722362