I am using an array to store 5 test scores. Then I have another array for the total possible score the test could have. I just need to find out what percent the grade is out of the total possible score.

public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        int[] grade = new int[5];
        int[] outOf = new int[5];
        int[] percents = new int[5];
        

        int total = 0;
        int average;
        int percent;

        grade[0] = 70;
        grade[1] = 65;
        grade[2] = 120;
        grade[3] = 150;
        grade[4] = 30;

        outOf[0] = 210;
        outOf[1] = 100;
        outOf[2] = 150;
        outOf[3] = 200;
        outOf[4] = 50;

        for(int i=0;i<grade.length;i++)
        {
            total += grade[i];

        }

        average = total / 5;

        System.out.println("The total is " + total + "\nThe"
                + " average is " + average);
        }
        
        for(int j=0;j<grade.length;j++)
        {
           
            
        }
}

Well to get the average of something you divide by the total number of items and then multiply by 100 to convert to a percentage. You haven't told us what criteria your using to split the grades though.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.