GPA calculator using collections in Java

GPA calculator using collections in Java

I have created small program for creating GPA, which is working absolutely perfect for my scenario if you have any suggestion please provide same in below comment.

package com.onlinetutorials.tech;

import java.util.Scanner;

public class OnlineTutorialGPACalculator {
public static void main(String args[]) {
Scanner onlineTutorialsInput1 = null, onlineTutorialsInput2 = null, onlineTutorialsInput3 = null;
try {
double gradePerAnnum;
double studentProvidedInput = 0;
int studiedClasses, totalHours, entredInputForTotalHouors = 0;
String studentGrade = "";
onlineTutorialsInput1 = new Scanner(System.in);
System.out
.println("===Please provide input for number of classses==");
studiedClasses = onlineTutorialsInput1.nextInt();
int totalEarnedHoursByStudentd = 0;
if (studentGrade.equalsIgnoreCase("A"))
studentProvidedInput = 4.0;
else if (studentGrade.equalsIgnoreCase( "A-"))
studentProvidedInput = 3.67;
else if (studentGrade.equalsIgnoreCase( "B+"))
studentProvidedInput = 3.33;
else if (studentGrade.equalsIgnoreCase( "B"))
studentProvidedInput = 3.0;
else if (studentGrade.equalsIgnoreCase( "B-"))
studentProvidedInput = 2.67;
else if (studentGrade.equalsIgnoreCase( "C+"))
studentProvidedInput = 2.33;
else if (studentGrade.equalsIgnoreCase( "C"))
studentProvidedInput = 2.0;
else if (studentGrade.equalsIgnoreCase( "C-"))
studentProvidedInput = 1.67;
else if (studentGrade.equalsIgnoreCase( "D+"))
studentProvidedInput = 1.33;
else if (studentGrade.equalsIgnoreCase( "D"))
studentProvidedInput = 1.0;
else if (studentGrade.equalsIgnoreCase( "D-"))
studentProvidedInput = 0.67;
else if (studentGrade.equalsIgnoreCase( "F"))
studentProvidedInput = 0;

for (int i = 0; i < studiedClasses; i++) {
onlineTutorialsInput2 = new Scanner(System.in);
System.out
.println("===Enter hours of studies for this course===");
totalHours = onlineTutorialsInput2.nextInt();
onlineTutorialsInput3 = new Scanner(System.in);
System.out
.println("===Enter Grade of this class===");
studentGrade = onlineTutorialsInput3.next();
totalEarnedHoursByStudentd += totalHours;
totalEarnedHoursByStudentd += (totalHours * studentProvidedInput);

}
gradePerAnnum = totalEarnedHoursByStudentd
/ entredInputForTotalHouors;
System.out.println(gradePerAnnum);
} catch (Exception ex) {
System.err.println(ex.getStackTrace());
} finally {
onlineTutorialsInput1.close();
onlineTutorialsInput2.close();
onlineTutorialsInput3.close();
}

}

}

GPA calculator using collections in Java| OnlineTutorials.tech

%d bloggers like this: