-
Notifications
You must be signed in to change notification settings - Fork 0
/
gaji.java
65 lines (56 loc) · 1.83 KB
/
gaji.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
//projekDaspro;
public class connection {
namaGuru[] namaGuru = new namaGuru[100];
int size = 0;
// input data
public void inputNamaGuru(namaGuru data){
namaGuru[size] = data;
size++;
}
// cari username
public int cariUsername(String Username){
int index = -1;
for(int i = 0; i < size; i++){
if(namaGuru[i].Username.equals(Username)){
index = i;
break;
}
}
return index;
}
// cari indeks id nama guru
public int cariIdNamaGuru(int id){
int index = -1;
for(int i = 0; i < size; i++){
if(namaGuru[i].idnamaGuru == (id)){
index = i;
break;
}
}
return index;
}
// update gaji guru
public void updateGajiGuru(int id, double gajipokok, double lamajammengajar, double tunjangan){
int index = cariIdNamaGuru(id);
namaGuru[index].gajipokok = gajipokok;
namaGuru[index].lamajammengajar = lamajammengajar;
namaGuru[index].tunjangan = tunjangan;
// Add this line to print a message
System.out.println("Gaji update for namaGuru with id: " + id);
}
// tampil daftar nama guru
public void tampil() {
for (int i=0; i< size; i++) {
namaGuru[i].tampil();
// Add this line to print a message
System.out.println("Printing data for namaGuru " + i);
}
}
// tampilkan data tertentu
public void tampilDataTertentu(int id) {
int index = cariIdNamaGuru(id);
namaGuru[index].tampil();
// Add this line to print a message
System.out.println("Printing data for namaGuru with id: " + id);
}
}