Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please do these fast ... i will give you an upvote Question 5[4+4) Write codes to complete the following the two tasks for the provided

image text in transcribed

Please do these fast ... i will give you an upvote

Question 5[4+4) 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 class Student ! String name; int id; double cgpa: public class Main public static void main(String[] args) { ArrayList list = new ArrayList(); public Student (String name, int id, double egpa) this.name name: this.id = id; this.cgpa - copa, 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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design And Implementation

Authors: Edward Sciore

2nd Edition

3030338355, 978-3030338350

More Books

Students also viewed these Databases questions