jeudi 12 mars 2015

How to take an array and convert all numbers to other numbers. 'JAVA'



I am trying to make a GPA calculator in java. Once I have all the grades in my array I would like to have another array that puts all the GPA's into the same size array. For example arrayA = [90, 95, 80, 87, 100] .... I want to be able to convert those numbers to arrayB and make it equal [3.7, 4.0, 2.7, 3.3, 4.3]


Here is what I have so far:



import java.util.Scanner;
import java.util.Arrays;
/**
Coleman Strauss
GPA Calculator
March 12, 2015
*/
public class GPACalculator
{
public static void main (String[] args)
{
int numClasses;
Scanner scan = new Scanner(System.in);
double[] myArrayGrades;
double[] myArrayGPA;


System.out.println("Please enter in the amount of classes you have: ");
numClasses = scan.nextInt();

System.out.println("Alright so you have " + numClasses + " classes.");

myArrayGrades = new double[numClasses];

for (int i=0; i < numClasses; i++) {
System.out.println("Please enter all your grades in a row!");

}

System.out.println(myArrayGrades);




}


}




Aucun commentaire:

Enregistrer un commentaire