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, 21.06.2019 23:00
In a file-oriented information system, a work file stores relatively permanent data about an entity is created and saved for backup and recovery purposes stores records that contain day-to-day business and operational data is a temporary file created by an information system for a single task
Answers: 1
question
Computers and Technology, 22.06.2019 08:00
Aplan to budget time for studying and activities is referred to as a study routine. study habits. study skills. a study schedule.
Answers: 1
question
Computers and Technology, 22.06.2019 22:00
Discuss the ways in which electronic information associated with payments is addressed in terms of security. include encryption, secure sockets layers, and secure electronic transactions in your discussion. are there any other ways that consumers and businesses can keep their payment information secure in an electronic commerce environment? do you feel that your information is safe when conducting electronic business? why or why not?
Answers: 1
question
Computers and Technology, 23.06.2019 03:10
Acomputer has a two-level cache. suppose that 60% of the memory references hit on the first level cache, 35% hit on the second level, and 5% miss. the access times are 5 nsec, 15 nsec, and 60 nsec, respectively, where the times for the level 2 cache and memory start counting at the moment it is known that they are needed (e.g., a level 2 cache access does not even start until the level 1 cache miss occurs). what is the average access time?
Answers: 1
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, 19.12.2019 07:31
question
Mathematics, 19.12.2019 07:31
Questions on the website: 13722360