Java Question
Java Question
Scanner;
import java.util.*;
class Student{
int studentID;
String studentName;
float studentMarks;
int searchName=FindStudentName(students,name);
if(searchName==-1){
System.out.println("Student not found");
}
else
System.out.println("Student Found with the id" + searchName);
}
public static int FindStudentName(Student[] students,String name){
for(int i=0;i<=students.length-1;i++){
if(students[i].studentName.equalsIgnoreCase(name)){
return students[i].studentID;
}
}
return -1;
}