Question: In the StudentArrayDemo.java, student array accept student object as parameter: find the first student object information according to s1 object, to find his/her name, id,

In the StudentArrayDemo.java, student array accept student object as parameter:

find the first student object information

according to s1 object, to find his/her name, id, gpa

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

find the highest GPA from student array:

import java.util.*;

public class StudentArrayDemo {

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. create a student array with initial student object information Student studentArray [] = {s1,s2,s3,s4};

// 3. output the student array information for ( int index = 0; index < studentArray.length; index ++ ) { System.out.println( studentArray [index] ); }

// 4. search student information in the array, and check this fruit is in the list or not // Q1. find the first student object information

// Q2. according to s1 object, to find his/her name, id, gpa

// Q3. if there is given student's name, // we need search this name and find this student // is in the student array or not Scanner scan = new Scanner(System.in); System.out.println(" Which student you want to search from student array? "); String typeName = scan.next();

// Q4. find the highest GPA from student array

}

}

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!