Question: Write a program that initializes an array with ten random integers and then prints five lines of output containing the following: Line 1: The array
Write a program that initializes an array with ten random integers and then prints five lines of output containing the following:
Line 1: The array as generated
Line 2: every element at an even index
Line 3 : every element with an even value
Line 4: all elements in reverse order
Line 5: only the first and last element
As always, your program should be easy to read with proper indents, line breaks, meaningful variable names and comments. Grading will be on both form and function. Be sure to label each line of output with a description (i.e. "Array as generated: ")
Array 10 - Specifications Write a program that initializes an array with ten random integers and then prints five lines of output containing the following: Line 1: The array as generated Line 2: every element at an even index Line 3 every element with an even value Line 4: all elements in reverse order Line 5: only the first and last element As always, your program should be easy to read with proper indents, line breaks, meaningful variable names and comments. Grading will be on both form and function. Be sure to label each line of output with a description (i.e. "Array as generated: ") Although optional, I encourage you to create methods for each task - this is optional, not required. (Hint: System.out.print (x) keeps the cursor on the same line after displaying x, System.out.println (x) moves the cursor to a new line after displaying x, System.out.println) moves the cursor to a new line.) Submit Array10.java using the link provided
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
