Question: Write a method that receives an array of integers as its parameter and modifies the contents of the array, by adding 1 the even values
Write a method that receives an array of integers as its parameter and modifies the contents of the array, by adding 1 the even values and subtracting 1 from the odd values. Example: If the array contained {37, 25, 19, 67, 82} then when the method returns the array contents would be {36, 24, 18, 66, 83}. Your method should work for an array of any size. Be sure to declare any local variable you may need. public static void modify (int[] list) {}//end reverse Write a method that receives an array of integers (o any length) a its parameter and returns true if the array contains no even number, otherwise it returns false. Example: If the array sent to it is {35, 17, 23} it returns true, the array is {29, 34, 13, 56) then it returns false. public static boolean hasNoEven(int[] arr) {//end method show the output from the following program fragment. public static void main(String[] args) {int[] arr = {34, 25, 67, 29, 12}; modify (arr); printArray(arr);}//end main Public static void modify (int[] arr) {for (int k = 0; k
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
