Question: Exercise 2.1 | ArrayList Instruction 1. Create a Java class in the _1_CS201 Your Last NameFirstNameSection project. Name the class ArrayListOfArrayElements. 2. Create a

Exercise 2.1 | ArrayList Instruction 1. Create a Java class in the _1_CS201 Your Last NameFirstNameSection project. Name the class ArrayListOfArrayElements. 2. Create a method that will handle the following operations. Declare a variable that will dynamically accept an array size. The size and contents of the array are arbitrary. Declare an array that accepts numerical values. Use an appropriate iteration control structure to accept the elements of the array. 3. Create another method that will handle the following operations. Declare a variable that will dynamically accept an array size. The size and contents of the array are arbitrary. Declare an array that accepts String values. Use an appropriate iteration control structure to accept the elements of the array. 4. Create another method that will copy the elements of the array of numerical values to an ArrayList. Manipulate the array elements using your choice of 10 ArrayList methods. 5. Create another method that will copy the elements of the array of String values to ArrayList. Manipulate the array elements using your choice of 10 ArrayList methods. 6. Use an appropriate iteration control structure to display the elements of the two ArrayLists. 7. Use an appropriate iteration control structure to display the elements of the two ArrayLists. LineSeparator Exercise 2.2 Stack LineSeparator Instruction 1. Create a class in _1_CS201 Your Last NameFirstNameSection. Name the class StackRunner. This class will serve as the Runner. 2. Create another class named StackClass. 3. In the StackClass, create a Stack. Name the stack StackList. 4. Create two methods. Name the first method to add and the second method result. 5. Create an ArrayList to accept 10 randomly generated numbers from 1 - 100. 6. Use the add method of the Stack to push the elements from the ArrayList. 7. In the result method, display elements that are popped from the stack. 8. Instantiate the SampleClass in the StackRunner. Use the instance of the StackClass to execute the methods of the stack. 9. Run the program LineSeparator
Step by Step Solution
3.54 Rating (157 Votes )
There are 3 Steps involved in it
Sure Here is a basic implementation of the instructions provided for Exercise 21 and Exercise 22 jav... View full answer
Get step-by-step solutions from verified subject matter experts
