Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In java programming,thanks This is one question in three tasks 2 of 2 Task 2 (using the ArrayList class) Add a new class the current
In java programming,thanks
2 of 2 Task 2 (using the ArrayList class) Add a new class the current project and name it MyArrayList. In that class, add an instance variable, which is an ArrayList of integers. Use a constructor to populate the array list with numbers from a data file. Create a text file at the root of your project folder and then add 5 numbers to this file (one number per file). Use this file to populate the arraylist. Task 2 (using the ArrayList class) To the class you created in Task 2, add a method named reverseList0 that creates and returns an ArrayList which is the reverse of the original ArrayList. For example, if the original list was [2,4, -2, 5, 3, 0,7], the output from this method would be the list 17, 0, 3, 5, -2, 4, 2]. Task 3 (using the ArrayList class) To the same class from Task 2, add a method called makeCopies. This method will replace every integer k with k copies of itself. For example, if the list is: [2 4, -2, 5,3, 0, 7] before the method is invoked, it should be [2, 2, 4, 4, 4, 4, 5, 5, 5, 5, 5, 3, 3, 3, 7, 7, 7, 7, 7, 7, 7] after calling the method makeCopies. A negative value, or a 0 value, means that the value should be removed from the list. Test your method using the following list: [2, 4, -2, 5, 3,0,7,5] This is one question in three tasks
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started