-
Notifications
You must be signed in to change notification settings - Fork 0
/
Subject.java
63 lines (53 loc) · 1.58 KB
/
Subject.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
package com.rusta.gpa3;
public class Subject {
String subjectName;
String spinnerGrade;
int subjectCredits;
String subjectKey;
double cgpa;
public Subject() {
}
public Subject(String subjectName, String spinnerGrade, int subjectCredits, String key) {
this.subjectName = subjectName;
this.spinnerGrade = spinnerGrade;
this.subjectCredits = subjectCredits;
this.subjectKey = key;
}
public String getSpinnerGrade() {
return spinnerGrade;
}
public int getSubjectCredits() {
return subjectCredits;
}
public String getSubjectName() {
return subjectName;
}
public String getSubjectKey() {
return subjectKey;
}
public double getCgpa() {
if (spinnerGrade.equals("A"))
cgpa = 4.00;
else if (spinnerGrade.equals("A-"))
cgpa = 3.67;
else if (spinnerGrade.equals("B+"))
cgpa = 3.33;
else if (spinnerGrade.equals("B"))
cgpa = 3.00;
else if (spinnerGrade.equals("B-"))
cgpa = 2.67;
else if (spinnerGrade.equals("C+"))
cgpa = 2.33;
else if (spinnerGrade.equals("C"))
cgpa = 2.00;
else if (spinnerGrade.equals("C-"))
cgpa = 1.67;
else if (spinnerGrade.equals("D+"))
cgpa = 1.33;
else if (spinnerGrade.equals("D"))
cgpa = 1.00;
else if (spinnerGrade.equals("F"))
cgpa = 0.00;
return cgpa;
}
}