Java program that sorts and searches students 10 records
<p>am chidiebere, Am currently working on a program that sort 10 students records with the fields: Reg no, Names, Age, Qualification in Ascending order . And use the Reg no to serach for a given student. I through various research came up with a case study of a similar program for just 5 students but don't know how to search using this code. this is my program:</p>

<pre><code>import java.util.*;

class Student{
    int id;
    String name;
    int age;
    String department;
    String course;
    String grade;
    double gpa;

    Student(int id, String name,int age,String department,String course,String grade,double gpa){
        this.id=id;
        this.name=name;
        this.age=age;
        this.department=department;
        this.course=course;
        this.grade=grade;
        this.gpa=gpa;
    }
    public int getId(){
        return id;
    }
    public String getName(){
        return name;
    }
    public int getAge(){
        return age;
    }
    public String getDepartment(){
        return department;
    }
    public String getCourse(){
        return course;
    }
    public String getGrade(){
        return grade;
    }
    public double getGpa(){
        return gpa;
    }
}

public class CalculateGPA{
    public static void main(String[] args){
        Scanner input=new Scanner(System.in);
        ArrayList&lt;Student&gt; list=new ArrayList&lt;Student&gt;();
        double gpa=0;
        for(int i=0; i&lt;5; i++){
            System.out.print("Enter id: ");
            int id=input.nextInt();
            System.out.print("Enter Name: ");
            String name=input.next();
            System.out.print("Enter Age: ");
            int age=input.nextInt();
            System.out.print("Enter Department: ");
            String department=input.next();
            System.out.print("Enter course: ");
            String course=input.next();
            System.out.print("Enter grade: ");
            String grade=input.next();
            if(grade.equals("A")||grade.equals("a")){
                gpa=4;
            }
            else if(grade.equals("B")||grade.equals("b")){
                gpa=3;
            }
            else if(grade.equals("C")||grade.equals("c")){
                gpa=2;
            }
            else if(grade.equals("D")||grade.equals("d")){
                gpa=1;
            }
            else if(grade.equals("F")||grade.equals("f")){
                gpa=0;
            }
            list.add(new Student(id,name,age,department,course,grade,gpa));
        }
        for(Student s: list){
            System.out.println(s.getId()+"\t"+s.getName()+"\t"+s.getAge()+"\t"+s.getDepartment()+"\t"+s.getCourse()+"\t"+s.getGpa());
        }
    }
}
</code></pre>
