Question: In Java /*** This class has a main method that prints out an integer array in various ways Difficulty: Easy */ public class ArrayPrinter public

In Java

In Java /*** This class has a main method that prints out

/*** This class has a main method that prints out an integer array in various ways Difficulty: Easy */ public class ArrayPrinter public static void main(String[] args) int[] data = {2, 34, 57, 31, 5, 79, 88, 62, 98, 53, 42}; 10 -Start below here. To do: approximate lines of code = 2 // Write a loop to print out even indices (NOTE: not the elements) of array data // use System.out.print, not System.out.println so the numbers are printed on one line 16 -End here. Please do not remove this comment. Reminder: no changes outside the todo regions. System.out.println(); System.out.println("EXPECTED:"); System.out.println("0 2 4 6 8 10"); -Start below here. To do: approximate lines of code = 3 // Write a loop to print out even integer elements stored in array data // Hint: use the modulus operator % to determine if an integer element is even // -End here. Please do not remove this comment. Reminder: no changes outside the todo regions. System.out.println(); System.out.println("EXPECTED:"); System.out.println("2 34 88 62 98 42"); Ti print out there omenys hare reverse ord eroximate lines of code = 2 // Print out the elements in reverse order //Hint: use a for loop but start at the end of the array and count down 8 855 // -End here. Please do not remove this comment. Reminder: no changes outside the todo regions. System.out.println(); System.out.println("EXPECTED:"); System.out.println("42 53 98 62 88 79 5 31 57 34 2"); ----Start below here. To do: approximate lines of code = 1 V Print out Share the first rand last enement 56 56 57 58 59 60 61 62 // - --End here. Please do not remove this comment. Reminder: no changes outside the todo regions. System.out.println("EXPECTED:"); System.out.println("242"); } }

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 Databases Questions!