a simple java lab
Write the following methods:
- Write a method called display which is void and accepts an array of integers called array. You must use enhanced for-loop (aka For Each (链接到外部网站。)) in order to display array elements in this format: { 1 2 3 4 5} where the numbers are values inside the array.
- Write a method called maxMin which returns an int value and accepts two parameters: a boolean value called max, and an array of integers called array. This method returns the max value between array elements if max is true and returns min value if max is false. You must only use enhanced loop (Aka: For Each (链接到外部网站。)) in this method.
- Write a method called increase which returns an array of integers and accepts two parameters: an int value called num and an array of integers called array. This method increases all values in the given array by num.
- For instance: if the array contains {2, 1, 3, 6} and num is 5, the method should return {7, 6, 8, 11}.
- Write a main method that generates the following output by calling display, maxMin, increase methods.
- Hint: You can write the main method in 15 lines.