Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

public int max(int[] array) 5 points Status: Not Submitted //input method here Write a method that returns the maximum value in an int[] array. For

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

public int max(int[] array) 5 points Status: Not Submitted //input method here Write a method that returns the maximum value in an int[] array. For example: max(new int[]{1, 2, 3, 4, 5}) Should return: 5 If there are no elements in the array, return O. For example: max(new int[]{}) Should return: public int min(int[] array) 5 points Status: Not Submitted // Implement this method } Write a method that returns the minimum value in an int[] array For example: min(new int[]{1, 2, 3, 4, 5}) Should return: 1 If there are no elements in the array, return O. For example: min(new int[]{}) Should return: 1 public double average(int[] array) 2 - { 3 // Implement this method 4 } 5 points Status: Not Submitted Write a method that returns the average value in an int[] array. For example: average (new int[]{4, 1}) Should return: 2.5 If there are no elements in the array, return O. For example: average(new int[]{}) Should return: 1 public int[] reverse(int[] arr) 2- { 3 // Implement this method 4. } 6 points Status: Not Submitted Write a method that takes an int array and returns a reversed version of the array. For example: reverse(new int[]{1, 2, 3}) Should return an array with the values: [3, 2, 1] 1 public String middleElement(String[] array) 2-{ 3 //input your method here 4 } 3 points Status: Not Submitted Write a method that returns the middle element of a String[] array. If there are an odd number of elements in the array, return the element in the middle of the array. For example: middleElement(new String[]{"hello", "world", "!"}) Should return: "world" If there are an even number of elements in the array, return the second of the two middle elements. For example: middleElement(new String[]{"my", "name", "is", "Karel"}) Should return: "is" If there is are no elements in the array, return the empty String ". For example: middleElement(new String[]{}) Should return

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

=+How will this affect the recruiting process?

Answered: 1 week ago