Question: Question 5 [4 +41 Write codes to complete the following the two tasks for the provided codes: A. Find whether any student object with name

 Question 5 [4 +41 Write codes to complete the following the

Question 5 [4 +41 Write codes to complete the following the two tasks for the provided codes: A. Find whether any student object with name "Peter" exists in the list using the contains method of the list" object. Add required methods into the "Student" class to use the contains method B. Now sort the "list" in descending order of CGPA using Comparator public class Main public static void main(String[] args) { ArrayList list = new ArrayList(); class Student String name; int id; double cgpa; public Student (String name, int id, double cgpa)! this.name = name; this.id = id; this.cgpa = cgpa; } list.add(new Student ("Wizard", 3, 3.88)); list.add(new Student ("Peter", 2, 3.5)); list.add(new Student ("Wanda", 1, 3.88)); list.add(new Student ("Thanos", 41, 3.9)); list.add(new Student ("Yelena", 7, 3.75)); list.add(new Student ("Thor", 15, 3.89)); } public Student (String name) { this.name = name; this.id = -1; this.cgpa - -1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!