-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOlahData.java
74 lines (60 loc) · 1.56 KB
/
OlahData.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
package com.PBOTI21.TugasBesar;
public class OlahData extends Data {
public int getP1(int x) {
return super.p1[x]; // INHERITENCE
}
public int getP2(int x) {
return super.p1[x]; // INHERITENCE
}
public int getKelas(int x) {
return super.p1[x]; // INHERITENCE
}
public int getFkl(int x) {
int loop = 0;
int fkl = 0;
while (loop < super.kelas.length) {
// if (x < 5) {
if (super.p1[loop] == (x - 1) / 5 && super.p2[loop] == (x - 1) % 5 && super.kelas[loop] == 1) {
fkl += 1;
}
// }
loop++;
}
return fkl;
}
public int getTotalFkl() {
int loop = 0;
int total = 0;
while (loop < super.kelas.length) {
total += getFkl(loop);
loop++;
}
return total;
}
public int getFkc(int x) {
int loop = 0;
int fkc = 0;
while (loop < super.kelas.length) {
// if (x < 5) {
if (super.p1[loop] == (x - 1) / 5 && super.p2[loop] == (x - 1) % 5 && super.kelas[loop] == 0) {
fkc += 1;
}
// }
loop++;
}
return fkc;
}
public int getTotalFkc() {
int loop = 0;
int total = 0;
while (loop < super.kelas.length) {
total += getFkc(loop);
loop++;
}
return total;
}
public int getTotalAll() {
int total = getTotalFkc() + getTotalFkl();
return total;
}
}