1) Creating ArrayList objects to hold different types of objects….

Question Answered step-by-step 1) Creating ArrayList objects to hold different types of objects….  1) Creating ArrayList objects to hold different types of objects.2) Using loops (for loops and/or for-each loops) to iterate through an ArrayList.3) Following specifications to produce the desired output from your code.Starter Code: PE_ArrayList.java Download PE_ArrayList.javaExpected Output:Sample numbers:[4, 3, 7, 2, 5]The sum of the numbers in the ArrayList is: 21Sample strings:[cat, cloud, cookie, computer, color]cat cat cat catcloud cloud cloudcookie cookie cookie cookie cookie cookie cookiecomputer computercolor color color color colorNote: Your output will be different, as you are not expected to use the same numbers and Strings in your implementation.  // Add your name below:// Name:public class PE_ArrayList_starter {      // You are provided with some method headers.    // You may need to perform some actions to make the code work properly.   // Mouse over areas underlined in red to see what the IDE suggests doing.      // 1. usemethod findSum that accepts an ArrayList of Integers and returns the sum, as an Integer.   public static Integer findSum(ArrayList numbers) {         }      // 2. use a method printStrings that accepts two ArrayLists of the same size.   // 2a. Check that both ArrayLists provided contain the same number of objects.    //     If they don’t, print an error message and terminate.   // 2b. If they satisfy the same length requirement, iterate through both ArrayList objects,    //     using the numbers in one list to know how many times to print the String in the other.   //     For example: If “cat” is in position 0 in the String ArrayList and “2” is in position 0   //     in the Integer ArrayList, your method will print “cat cat”   //    Use a new line for each new element in the String ArrayList.   //    HINT: You may want to use nested loops to complete this task.   public static void printStrings(ArrayList strings, ArrayList numbers) {         }      // Your methods should work with the following main method,    // once you have completed the tasks indicated:      public static void main(String args[]) {            // 3.ArrayList “numbers” to hold Integer Objects. Add 5 numbers in the range (1-10) to your ArrayList.            Integer result = findSum(numbers);            System.out.println(“Sample numbers:” + numbers);      System.out.println(“The sum of the numbers in the ArrayList is: ” + result.toString());      System.out.println();            // 4.  ArrayList “strings” of String Objects. Add 5 Strings to your ArrayList.            System.out.println(“Sample strings:” + strings);      System.out.println();            printStrings(strings, numbers);               }   } Computer Science Engineering & Technology Java Programming CSE 143 Share QuestionEmailCopy link Comments (0)