-
Notifications
You must be signed in to change notification settings - Fork 0
/
smart.java
68 lines (58 loc) · 1.74 KB
/
smart.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
public class smart
{
double[][] data;
double[][] utility=new double[10][4];
double[] bobot;
double[] nilaiakhir=new double[10];
smart(double[][] nkriteria)
{
// initialise instance variables
data=nkriteria;
}
public void setBobot(double[] b){
bobot=b;
}
public void printData(){
for(int i=0; i<data.length; i++){
for(int j=0; j<data[0].length; j++){
System.out.println(data[i][j]+"");
}
System.out.println();
}
}
public void utilityC1(int min){
for(int i=0; i<utility.length; i++){
utility[i][0]=((data[i][0]-min)/(100-min))*100;
}
}
public void utilityC2(int min){
for(int i=0; i<utility.length; i++){
utility[i][1]=((data[i][1]-min)/(100-min))*100;
}
}
public void utilityC3(int min){
for(int i=0; i<utility.length; i++){
utility[i][2]=((data[i][2]-min)/(100-min))*100;
}
}
public void utilityC4(int min){
for(int i=0; i<utility.length; i++){
utility[i][3]=((data[i][3]-min)/(100-min))*100;
}
}
public void printUtility(){
for(int i=0; i<utility.length; i++){
System.out.println(utility[i][0]+""+utility[i][1]+""+utility[i][2]+""+utility[i][3]);
}
}
public void nilaiAkhir(){
for(int i=0; i<utility.length; i++){
nilaiakhir[i]=(bobot[0]*utility[i][0])+(bobot[1]*utility[i][1])+(bobot[2]*utility[i][2])+(bobot[3]*utility[i][3]);
}
}
public void printNilaiAkhir(){
for(int i=0; i<utility.length; i++){
System.out.println(nilaiakhir[i]);
}
}
}