How to take an array and convert all the numbers into 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(;
        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!");


It's simple, really. Test if the sizes are the same, and if so, convert. Don't forget to initialize the arrays

if(arrayA.size() == arrayB.size()){
//do nothing
exit; //array sizes are mismatched and will cause OutOfBounds exception

for(int i = 0; i < arrayA.size(); i++){
arrayB[i] = arrayA[i]*GPAConditional; /*GPAConditional is the constant conversion factor used to convert grades into GPA, ultimately defined by you*/

Note that changes to arrayA's elements change arrayB's elements!!