Question: I need help please. In the StudentListDemo.java, student list accept student object as parameter: if there is given student's name, we need search this name

I need help please.

In the StudentListDemo.java, student list accept student object as parameter:

if there is given student's name, we need search this name and find this student is in the student list or not

find the highest GPA from student list:

import java.util.*;

public class StudentListDemo {

public static void main(String[] args) {

// 1.instantiate several student object with their known name, id and gpa Student s1 = new Student("John", 11111, 3.68); Student s2 = new Student("Allen", 22222, 3.57); Student s3 = new Student("Mary", 33333, 4.0); Student s4 = new Student("Alex", 44444, 3.57);

// 2. build student list, and add these students information into list ArrayList studentList = new ArrayList();

// 3. output student information in student list for ( Student value: studentList) { System.out.println( value); }

// 4. search student information in the list, and check this fruit is in the list or not // find the first student information System.out.println ( studentList.get( 0 ) ); // studentList.get( 0 ): return student s1 object information

// s1 object call getName(), getID() and getGPA() // to find his/her name, id and gpa System.out.println ( studentList.get(0).getName() ); System.out.println ( studentList.get(0).getID() ); System.out.println ( studentList.get(0).getGPA() );

// Q1. if there is given student's name, // we need search this name and find this student is in the student list or not

Scanner scan = new Scanner(System.in); System.out.println(" Which student you want to search from student list? "); String typeName = scan.next();

// Q2. find the highest GPA from student list

}

}

I don't know what to do. thank you for your help

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!