Programming Assignment #5)

For assignment #4 you created a Student class. During lecture, we created a Date class. For this assignment, you need to add the instance variable "admissionDate" to the class Student (yes, classes can contain other classes). You should also add a static variable called numberOfStudents. Your new class should look something like the following:

public clas Student
{
       private static int numberOfStudents=0;      //initialize to zero

       private int ID;
       private String firstName;
       private String lastName;
       private double gpa;
       private Date admissionDate;

    ....more things to add and/or change

       // you will need a constructor that accept 5 parameters (see example below in driver program)
      
       // every  constructor should increment by 1 the class  variable numberOfStudents

     // your compareTo method should compare students by admissionDate. That is, if Student s1 was admitted
    //  before Student s2, then compareTo should reflect this

    // you will need to alter the toString method in Student (but not as much as you think

}

You should use the following driver program:

public class UseStudent
{
    prublic static void main(String [ ]args)
    {
       Student s1=new Student(13546,"james","smith",3.65, new Date(1,10,2015));
       Student s2=new Student(22331,"susan","adams",3.66, new Date(3,5,2014);
       Date d3=new Date(5,5,2011);
       Student s3=new Student(33221,"henry","davis",3.23, d3);

       if (s1.compareTo(s2)<0)
          System.out.println(s1+" is less than "+s2);
       else
          System.out.println(s2+ " is less than or equal to "+s1);


       // you need to add code here that will determine the least element of Students s1,s2,s3
       // and output to the screen. This code should work for any values given to s1,s2 and s3
    }
}