Inside the Main method of PlayWithArrays do the following: 1. Declare and initialize the below Arrays: a.
Question:
Inside the Main method of PlayWithArrays do the following: 1. Declare and initialize the below Arrays: a. moviesA - Declare as String array of size 5 and fill in 4 movie names through the keyboard. [0.2 points] b. doubleA - Declare as a double array of size 6 and fill in 5 numbers through the keyboard. [0.2 points] c. intA - Declare as an int array of size 7 and fill in 6 integers through the keyboard. [0.2 points] 2. a. TRAVERSE: Printing all the elements of moviesA, doubleA and intA. i. Print all three Arrays using standard library "Arrays" [0.2 points] ii. Print all three Arrays using For loop [0.2 points] b. INSERTION: a. Insert an element "Avengers" in moviesA at index 2 and print all [0.4 points] b. Insert element 20.89 in doubleA at index 2 and print all [0.3 points] c. Insert an element 369 in intA at index 2 and print all [0.3 points]
Objects Lab Page 2 of 6 c. DELETION: a. Delete the element at the index 1 from moviesA and print all. [0.4 points] b. Delete the element at index 1 from doubleA and print all. [0.3 points] c. Delete the element at index 1 from intA and print all. [0.3 points] d. SEARCH: You can perform a search for an array element based on its value or its index. a. Print out the position of "Avengers" in moviesA. [0.4 points] b. Print out the position of 20.89 in doubleA. [0.3 points] c. Print out the position of 369 in intA. [0.3 points] e. UPDATE: a. Replace "Avengers" in moviesA with "WonderWoman" and print all. [0.4 points] b. Replace 20.89 in doubleA with 67.45 and print all. [0.3 points] c. Replace 369 in intA with 729 and print all. [0.3 points] OUTPUT: Enter the movies array elements : Spy Next Door Girl Next Door The Boy Next Door The Evil Next Door Enter the double array elements : 1.2 2.3 3.4 4.5 5.6 Enter the integer array elements : 1 2 3 4 5 6 *****************TRAVERSE******************** [Spy Next Door, Girl Next Door, The Boy Next Door, The Evil Next Door, null]
Objects Lab Page 3 of 6 [1.2, 2.3, 3.4, 4.5, 5.6, 0.0] [1, 2, 3, 4, 5, 6, 0] Array movies before insertion : Spy Next Door Girl Next Door The Boy Next Door The Evil Next Door null Array double elements before insertion : 1.2 2.3 3.4 4.5 5.6 0.0 Array integer elements before insertion : 1 2 3 4 5 6 0 *****************INSERTION******************** movies array elements after insertion: Spy Next Door Girl Next Door Avengers The Boy Next Door The Evil Next Door doubleArray elements after insertion: 1.2 2.3 20.89 3.4 4.5 5.6 intArray elements after insertion: 1 2 369 3 4 5 6 *****************DELETION******************** Array movies elements after deleting: Spy Next Door Avengers The Boy Next Door The Evil Next Door doubleArray elements after deleting: 1.2 20.89 3.4 4.5 5.6 intArray elements after deleting: 1 369 3 4 5 6 *****************SEARCH******************** Element Avengers Found at index 1 of movies Element 20.89 Found at index 1 of doubleArray Element 369 Found at index 1 of intArray *****************UPDATE******************** movies after updating: Spy Next Door WonderWoman The Boy Next Door The Evil Next Door doubleArray elements after updating: 1.2 67.45 3.4 4.5 5.6 intArray elements after updating: 1 729 3 4 5 6 Inside the Main method of PlayWithArrayLists do the following:
Objects Lab Page 4 of 6 1. Declare and initialize the below ArrayLists: a. moviesAL - Declare as String ArrayList of size 4 and fill in 4 movie names through the keyboard. [0.2 points] b. doubleAL - Declare as a double ArrayList of size 5 and fill in 5 numbers through the keyboard. [0.2 points] c. intAL - Declare as an int ArrayList of size 6 and fill in 6 integers through the keyboard. [0.2 points] 2. a. TRAVERSE: Printing all the elements of moviesAL, doubleAL and intAL. i. Print all three ArrayList using standard library "ArrayLists" [0.2 points] ii. Print all three ArrayList using For loop [0.2 points] b. INSERTION: i. Insert an element "Avengers" in moviesAL at index 2 and print all [0.4 points] ii. Insert element 20.89 in doubleAL at index 2 and print all [0.3 points] iii. Insert an element 369 in intAL at index 2 and print all [0.3 points] c. DELETION: i. Delete the element at the index 1 from moviesAL and print all. [0.4 points] ii. Delete the element at index 1 from doubleAL and print all. [0.3 points] iii. Delete the element at index 1 from intAL and print all. [0.3 points] d. SEARCH: You can perform a search for an array element based on its value or its index. i. Print out the position of "Avengers" in moviesAL. [0.4 points] ii. Print out the position of 20.89 in doubleAL. [0.3 points] iii. Print out the position of 369 in intAL. [0.3 points] e. UPDATE: i. Replace "Avengers" in moviesAL with "WonderWoman" and print all. [0.4 points] ii. Replace 20.89 in doubleAL with 67.45 and print all. [0.3 points] iii. Replace 369 in intAL with 729 and print all. [0.3 points] OUTPUT: Enter the movie names : Spy Next Door Girl Next Door The Boy Next Door The Evil Next Door Enter the double elements: 1.23 2.34
Objects Lab Page 5 of 6 3.45 4.56 5.67 Enter the integers: 1 2 3 4 5 6 *****************TRAVERSE******************** [Spy Next Door, Girl Next Door, The Boy Next Door, The Evil Next Door] [1.23, 2.34, 3.45, 4.56, 5.67] [1, 2, 3, 4, 5, 6] *****************INSERTION******************** [Spy Next Door, Girl Next Door, Avengers, The Boy Next Door, The Evil Next Door] [1.23, 2.34, 20.89, 3.45, 4.56, 5.67] [1, 2, 369, 3, 4, 5, 6] *****************DELETION******************** [Spy Next Door, Avengers, The Boy Next Door, The Evil Next Door] [1.23, 20.89, 3.45, 4.56, 5.67] [1, 369, 3, 4, 5, 6] *****************SEARCH******************** Index of Avengers element in moviesAL is 1 Index of 20.89 element in doubleAL is 1 Index of 369 element in intAL is 1 [Spy Next Door, Avengers, The Boy Next Door, The Evil Next Door] [1.23, 20.89, 3.45, 4.56, 5.67] [1, 369, 3, 4, 5, 6] *****************UPDATION******************** [Spy Next Door, WonderWoman, The Boy Next Door, The Evil Next Door] [1.23, 67.45, 3.45, 4.56, 5.67] [1, 729, 3, 4, 5, 6]