Part 1: Array list implementation: array list implements list interface plus their own functions. 1. a. Create a ArrayList of type Integer and name it as Grades. b. Create a ArrayList of type String and name it as Students. c. Create a ArrayList of type Double and name it as Results. 2. Add the following values to the array List using add function 30, 40,80 ,100,70,100,10,100,10 Print the size of the array list using size () function. 3.Search for 100 in the array list, if you find it, print a message that “those grades are perfect”. Use only contains function. 4. Repeat the step 3 using equals function. 5. Check if array list is empty or not using isEmpty() function. Print a message if it’s empty and if it’s not empty also.
Part 1: Array list implementation: array list implements list interface plus their own functions.
1. a. Create a ArrayList of type Integer and name it as Grades.
b. Create a ArrayList of type String and name it as Students.
c. Create a ArrayList of type Double and name it as Results.
2. Add the following values to the array List using add function 30, 40,80 ,100,70,100,10,100,10 Print the size of the array list using size () function.
3.Search for 100 in the array list, if you find it, print a message that “those grades are perfect”. Use only contains function.
4. Repeat the step 3 using equals function.
5. Check if array list is empty or not using isEmpty() function. Print a message if it’s empty and if it’s not empty also.
6. the grade is under 20 which is outlier, remove it from the array list.
7. Print array list using System.out.println()
8. Use indexOf to print index of 80.
9. Use get function.
10. What is the difference between get and index of?
11. Print the values of the array list using Iterator class.
12.. Delete all the values of the array list using clear function.
13. Print all the values of the array after you execute clear using System.out.println(). what is the result of using clear function?
Step by step
Solved in 4 steps with 4 images
6. the grade is under 20 which is outlier, remove it from the array list.
7. Print array list using System.out.println()
8. Use indexOf to print index of 80.
9. Use get function.
10. What is the difference between get and index of?
11. Print the values of the array list using Iterator class.
12.. Delete all the values of the array list using clear function.
13. Print all the values of the array after you execute clear using System.out.println(). what is the result of using clear function?
14. What is the shortcoming of using array List?