-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDiscipline.java
More file actions
47 lines (38 loc) · 1.5 KB
/
Discipline.java
File metadata and controls
47 lines (38 loc) · 1.5 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
45
46
47
public abstract class Discipline {
private String title;
protected double currentOnlineLessonsGrade;
protected double maxOnlineLessonsGrade;
protected String equivalentRating= "Неудолетворительно";
public Discipline(String title) {
this.title = title;
}
public Discipline(String title, double currentGrade, double maxGrade) {
this.title = title;
this.currentOnlineLessonsGrade = currentGrade;
this.maxOnlineLessonsGrade = maxGrade;
}
public Discipline(String title, double currentGrade) {
this.title = title;
this.currentOnlineLessonsGrade = currentGrade;
this.maxOnlineLessonsGrade = Double.POSITIVE_INFINITY;
}
public String getTitle() {
return title;
}
public double getCurrentOnlineLessonsGrade() {
return currentOnlineLessonsGrade;
}
public double getMaxOnlineLessonsGrade() {
return maxOnlineLessonsGrade;
}
public String getEquivalentRating() {
return equivalentRating;
}
public void UpdateEquivalentRating() {
double ratio = (getCurrentOnlineLessonsGrade() / getMaxOnlineLessonsGrade());
if (ratio >= 0.8) equivalentRating = "Отлично";
else if (ratio >= 0.6) equivalentRating = "Хорошо";
else if (ratio >= 0.4) equivalentRating = "Удолетворительно";
else equivalentRating = "Неудолетворительно";
}
}