【发布时间】:2016-10-16 18:00:06
【问题描述】:
*/
public static double ranNumber(double [] gradeArray) {
double rN = 0;
for (int i = 0; i < gradeArray.length; i++) {
rN = 55 + Math.random() * (100 - 55) + 1; //this section is to generate a # between 55-100.
}
return rN;
}
/**
*
* @param input
*
*/
public static void outputArray(double [] input) { // this is where I want the random # to go and to later convert to letter grade.
for (int count = 1; count <= input.length; count++) {
System.out.printf("Grade %d: %.2f is a ", count+1 , input[count]);
}
}
好的,所以我只发布了这两种方法,因为我想要尝试做的是将随机数放入 outputArray 以便我可以将双精度转换为字母等级。我的输出应该类似于“1 年级:93.23 是 A-”。
【问题讨论】:
-
您对返回字母等级的方法的尝试在哪里?
-
或者你在哪里打电话给
ranNumber?为什么会生成gradeArray.length- 很多数字,但只返回一个值?