import java.util.Scanner;

public class gpacalculator {
    public static void main(String[] args) {
        Scanner userInput = new Scanner(System.in);
        int sum = 0; //intialize sum to 0, the gpa will be summed up in the for loop       
        System.out.println("Number of classes:");
        int classes = userInput.nextInt();
        System.out.println("I am taking " + classes+ " classes");
        System.out.println("My class letter grades:"); // enter as uppercase or lowercase
        for (int i = 0; i <= classes; i++) {
            int gpa = 0; // intializing variable gpa as 0
            String grade = userInput.nextLine();
            System.out.println(grade);
            if (grade.equals("A") || grade.equals("a")) {
                gpa = 4;
            } else if (grade.equals("B") || grade.equals("b")) {
                gpa = 3;
            } else if (grade.equals("C") || grade.equals("c")) {
                gpa = 2;
            } else if (grade.equals("D") || grade.equals("d")) {
                gpa = 1;
            } else if (grade.equals("F") || grade.equals("f")) {
                gpa = 0;
            }
            sum = sum + gpa;
        }

        float gpaWhole = (float) sum/(float) classes;

        System.out.println("Your Overall GPA: " + gpaWhole);
    }
}

gpacalculator.main(null);
Number of classes:
I am taking 5 classes
My class letter grades:

A
a
C
d
A
Your Overall GPA: 3.0