Question: solve in Java everything including extra credit Implement the following functions. Do not change the structure of the functions. 1. Return the number of even

Implement the following functions. Do not change the structure of the functions. 1. Return the number of even ints in the given array. Note: the % "mod" operator computes the remainder, e.g., 5%2 is 1. countEvens ([2,1,2,3,4])3 countEvens ([2,2,0])3 countEvens ([1,3,5])0 public int countEvens(int[] nums) \{ \} 2. Return the sum of the numbers in the array, returning 0 for an empty array. Except the number 13 is very unlucky, so it does not count and numbers that come immediately after a 13 also do not count. sum 13([1,2,2,1])6 sum13([1,1])2 sum 13([1,2,2,1,13])6 public int sum 13 (int [] nums ){ \} 3. Given arrays nums1 and nums 2 of the same length, for every element in nums1, consider the corresponding element in nums2 (at the same index). Return the count of the number of times that the two elements differ by 2 or less, but are not equal. matchUp ([1,2,3],[2,3,10])2 matchUp([1,2,3],[2,3,5])3 matchUp([1,2,3],[2,3,3])2 public int matchUp(int[] nums1, int[] nums2) \{ \} 4. Given an array of ints, return true if the array contains two 7's next to each other. has 77([1,7,7]) true has 77([1,7,1,7]) false has 77([1,7,1,1,7]) false public boolean has 77 (int[] nums) \{ \} 5. Return an array that contains the exact same numbers as the given array, but rearranged so that all the even numbers come before all the odd numbers. Other than that, the numbers can be in any order. You may modify and return the given array, or make a new array. evenOdd ([1,0,1,0,0,1,1])[0,0,0,1,1,1,1] evenOdd([3,3,2]) [2,3,3] evenOdd ([2,2,2])[2,2,2] public int [] evenOdd(int [] nums) \{ \} EXTRA CREDIT: Given an array of ints and a sum. Return true if there are any two numbers in the array that equal to the given sum. isSum ([3,5,9,19,0],24]) true ( since 5+19=24) isSum([3,5,1,15,0],24]) false (the array does not contain any two numbers that sum up to 24) Public boolean issum(int[] nums, int sum) \{ \}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
