// two classes - a Student class
// and a School class that is filled with Students


import java.io.*;
public class Student

 {public static input in = new input();   // input library
  private double gpa;
  private String na;
  private int grade;
  private String gender;
  
  public Student(String n,double g,int gr, String gen)
   {na = n;
     gpa = g;
     grade = gr;
     gender = gen;
    }
  
 public String getName()
  {return na;
    }
  
    
 public double getGrade()
  {return grade;
    }   
 
 public double getGPA()
  {return gpa;
    }
      
    
  private String getGender()
   {return gender;
    }
    
  public int compareTo(Student o)
    {if (grade == o.getGrade())
         return 0;
      else
       if (grade > o.getGrade())
        return 1;
       else
          return -1;
    }
}
__________________________
import java.util.*;
import java.io.*;
public class School

 {public static input in = new input();   // input library
  private ArrayList<Student> ar = new ArrayList<Student>();
  
  public School()
   {fill();
    }
  
  public void fill()
   {Student s1 = new Student("Mary",3.4,9,"F");
     Student s2 = new Student("Joe",3.2,10,"M");
     Student s3 = new Student("Tom",4.4,11,"M");
     Student s4 = new Student("Mark",3.7,12,"M"); 
     Student s5 = new Student("Sue",3.1,9,"F");
     Student s6 = new Student("Helen",2.4,10,"F");
     Student s7 = new Student("Nancy",2.4,11,"F");
     Student s8 = new Student("Kelly",3.4,12,"F");
     Student s9 = new Student("Kira",3.6,9,"F");
     Student s10 = new Student("Meghan",2.5,10,"F");
     Student s11 = new Student("Colleen",2.8,11,"F");
    Student s12 = new Student("Betsy",2.6,12,"F");
    Student s13 = new Student("Ed",2.2,9,"M");
    Student s14 = new Student("Mike",1.5,10,"M");
    Student s15 = new Student("Sean",1.7,11,"M");
    Student s16 = new Student("Rob",2.8,12,"M");
    Student s17 = new Student("Chris",3.1,9,"M");
    Student s18 = new Student("Noah",4.1,10,"M");
    Student s19 = new Student("Abigail",3.6,11,"F");
    Student s20 = new Student("Fred",3.3,12,"M");
    ar.add(s1);ar.add(s2);ar.add(s3);ar.add(s4);
        ar.add(s5); ar.add(s6);ar.add(s7);
           ar.add(s8); ar.add(s9);ar.add(s10);ar.add(s11);
              ar.add(s12); ar.add(s13);ar.add(s14);
                 ar.add(s15);ar.add(s16); ar.add(s17); ar.add(s18);
                     ar.add(s19); ar.add(s20);
                    
}
  
  public void adder(Student s)
   {ar.add(s);
    }
    
    public void print()
     {for (int x = 0; x < ar.size(); x++)
          System.out.println(ar.get(x).getName());
        }
    }