我制作了这段代码来计算数字:
import java.util.Random;
public class Sorting {
private double[] player;
private int k=5;
private int j=5;
public void sort(){
player = new double[k];
for(int i=1;i<k;i++){
double tempp ;
for(i=1;i<j;i++){
tempp = Math.random() * i;
player[i]=tempp;
System.out.println("Result "+i+"="+player[i]);
}
}
}
public static void main(String []args){
Sorting k=new Sorting();
k.sort();
}}
结果是:
Result 1=0.4529689730194949
Result 2=0.09643822768644617
Result 3=1.841047494651026
Result 4=2.1807153629323777
现在,我想添加一个标签,从最大到最小的结果编号标记为 EXCELLENT、VERY GOOD、GOOD 和 BAD,如下所示:
Result 1=0.4529689730194949 labeled GOOD
Result 2=0.09643822768644617 labeled BAD
Result 3=1.841047494651026 labeled VERY GOOD
Result 4=2.1807153629323777 labeled EXCELLENT