Please see the description of the TODOs in the starter file'scomments.
The following is a sample run (bold fonts represent userinputs):
Main.JavaⒸ ✪ New 1 public class Main 2 - { 3 4- 5 6 8 9 SENANG=%987227 10 11 12 13 14 15 16 17 18 19 20 - 21 23 24 25 26 28 29 30 31 32 } public static void main(String[] args) { } java.util.Scanner input = new java.util.Scanner(System.in); System.out.println("Enter the size of the array to be created: "); int size input.nextInt (); //Create an int array (name it myList) that has the size the user just entered. int[] arr = new int[size]; //TODO 1: Write a loop to get user enter values that will be stored in the array System.out.println("Enter " + size + " integers: "); //TODO 2: Print the array System.out.println("Array (original): "); * TODO 3: write code below to reverse the array arr. * That is, arr[0] and arr[arr.length-1] will be swapped, * arr[1] will get arr[arr.length-2] will be swapped, //TODO 4: Print the array again System.out.println("Array (after reverse): ");
Please see the description of the TODOs in the starter file's comments. The following is a sample run (bold fonts repres
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am