-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathStudentInfo.java
85 lines (76 loc) · 1.8 KB
/
StudentInfo.java
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
import java.util.ArrayList;
public class StudentInfo{
private long uniqueID;
private String name;
private String ID;
private String major;
private String status;
private Float totalGrade;
private ArrayList<Assignment> assignments = new ArrayList<Assignment>();
public StudentInfo(long uniqueID, String name, String ID, String major, String status) {
this.name = name;
this.ID = ID;
this.major = major;
this.status = status;
this.uniqueID = uniqueID; //database unique identifier to identify column
}
public Float getTotalGrade() {
Float current=0f;
int length = getNumAssignments();
for (int x=0; x<length; x++) {
Float grade = assignments.get(x).getGrade();
Float weight = assignments.get(x).getWeight();
current += (grade*weight);
}
return current;
}
public String getName() {
return name;
}
public String getID() {
return ID;
}
public String getMajor() {
return major;
}
public String getStatus() {
return status;
}
public long getUniqueID() {
return uniqueID;
}
public int getNumAssignments() {
return (assignments.size());
}
public String getLetterGrade() {
String letterGrade = "A";
if(totalGrade<=95 && totalGrade>=90) {
letterGrade = "A-";
}
else if (totalGrade>=87 && totalGrade<90) {
letterGrade = "B+";
}
else if (totalGrade<87 && totalGrade>83) {
letterGrade = "B";
}
else if (totalGrade>=80 && totalGrade<83) {
letterGrade = "B-";
}
else if (totalGrade >= 77 && totalGrade<80 ) {
letterGrade = "C+";
}
else if (totalGrade <77 && totalGrade>73) {
letterGrade ="C";
}
else if(totalGrade<=73 && totalGrade>=70) {
letterGrade ="C-";
}
else if(totalGrade <= 69 && totalGrade >= 60) {
letterGrade = "D";
}
else if(totalGrade <60) {
letterGrade = "F";
}
return letterGrade;
}
}