-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExamTwoDriver.java
More file actions
44 lines (29 loc) · 1.26 KB
/
ExamTwoDriver.java
File metadata and controls
44 lines (29 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
public class ExamTwoDriver {
public static void main(String[] args){
StudentAthlete a = new StudentAthlete(123, "John", 0);
StudentT b = new StudentT(321,"Jose");
StudentAthlete c = new StudentAthlete(93, "Nate", 1);
StudentT d = new StudentT(872,"Alden");
StudentT[] container = {a,b,c,d};
// set the gpa of both students to 2.75
b.setGpa(2.75);
a.setGpa(2.75);
c.setGpa(2.9);
d.setGpa(3.0);
// student a is an athlete and has been playing for 2 years.
a.setYearsPlayed(2);
c.setYearsPlayed(1);
// a qualifies for a scholarship despite only having a 2.75 gpa while b doesn't as isn't a student athlete.
System.out.println("John's qualification: " + a.qualifiesForScholarship());
System.out.println("Jose's qualifcation: " + b.qualifiesForScholarship());
display(container);
}
// If the student or studentathlete object returns true in the qualifiesFOrScholarship method then we will display the student's name.
public static void display(StudentT[] container) {
for(StudentT a : container ) {
if(a.qualifiesForScholarship()) {
System.out.println(a);
}
}
}
}