Question: Create a Java class called ReplaceZero that creates an integer array of 10 values. The values must be input by the user. You must make

Create a Java class called ReplaceZero that creates an integer array of 10 values.

The values must be input by the user.

You must make sure that the input values are in the range of -5 and 15. All other values input by the user must be rejected. The array must also include zero as one input value anywhere in the array.

This array must be passed as an argument to a method called zeroToLargestOdd where the zero value in the array is replaced by the largest odd value to the right of the zero in the array. If there is no odd value to the right of the zero, replace the zero with -99 and exit the loop

Note: If your array has more than one zero, those don't need to be replaced.

Once the method completes execution and the control passes back to the main method, display the array with all the values on the same line separated by one space. Remember to close the Scanner object.

Need it ASAP please!!

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!