Question: Lab Description: Write a program that will search an array to find the first odd number. If an odd number is found, then find the



Lab Description: Write a program that will search an array to find the first odd number. If an odd number is found, then find the first even number following the odd number. Return the distance between the first odd number and the FIRST even number. Return -1 if no odd numbers are found or there are no even numbers following an odd number. Sample Data [7,1,5,3,11,5,6,7,8,9,10,12345,11] Files Needed: OddToEvenRunner . java RayOddToEven. java [10,20,30,40,5,41,31,20,11,7] [32767,70,4,5,6,71 [2,7,11,21,5,7] 17,255,11,255,100,3,2] [9,11,11,11,7,1000,3] 17,7,7,11,2,7,7,11,11,2] [2,4,6,8,81 Sample Output 6 2 1 1 public class RayOddToEven public static boolean go(intl ray) return false; public class OddToEvenRunner public static void main( String args)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
