dimanche 16 octobre 2016

I am trying to do a grade array with random #'s and converting to letter grades

 */
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]);
    }
}

Ok, so I only posted these 2 methods, because what I am wanting to try to do is get the random number into the outputArray so that I can turn the double into a letter grade. My output should be something like, "Grade 1: 93.23 is a A-".




Aucun commentaire:

Enregistrer un commentaire