Beispiel #1
0
 public static Student getStudentWithHighestGPA() {
   System.out.println("~~~getStudentWithHighestGPA~~~");
   Student _greatestGPAStudent = addStudent("temp", Person.Gender.Male, 0.0, 1);
   for (Person temp : people) {
     if (temp instanceof Student) {
       if (((Student) temp).getGPA() > _greatestGPAStudent.getGPA())
         _greatestGPAStudent = ((Student) temp);
     }
   }
   return (_greatestGPAStudent);
 }
Beispiel #2
0
  public static void main(String[] args) {
    Student mel = new Student();

    mel.setStudentID(991);
    mel.setCreditHours(6);
    mel.setGradePoints(20);
    mel.calcGPA();

    System.out.println("Student ID: " + mel.getStudentID());
    System.out.println("Credit Hours: " + mel.getCreditHours());
    System.out.println("Grade Points: " + mel.getGradePoints());
    System.out.println("GPA: " + mel.getGPA());
  }
 @Override
 public int compare(Student s1, Student s2) {
   return (int) (1000 * (s1.getGPA() - s2.getGPA()));
 }