Hi all, I just joined this site. It looks like a nice place to learn new languages
/>
I am working on a java program as I am trying to learn Java Programming by myself.
I am working on a GPA Calculator program where you read a file that has information such as letter grades and grade numbers.
For example the first line in the text file would be like: A+ 9
Second line: B 6
I need help on separating the letter grades and the grade numbers into separate arrays and then finding the grade point average from the given information from the file.
Here is what I have so far:
I am still learning Java, so any help would be greatly appreciated. Thank you guys so much!

I am working on a java program as I am trying to learn Java Programming by myself.
I am working on a GPA Calculator program where you read a file that has information such as letter grades and grade numbers.
For example the first line in the text file would be like: A+ 9
Second line: B 6
I need help on separating the letter grades and the grade numbers into separate arrays and then finding the grade point average from the given information from the file.
Here is what I have so far:
import java.util.*; import java.io.File; import java.io.FileInputStream; import java.io.InputStreamReader; import java.io.BufferedReader; import java.io.IOException; public class GPACalculator { public static Scanner console = new Scanner(System.in); public static int [] gradePointValue = {9, 8, 7, 6, 5, 4, 3, 2, 1}; public static String[] letterGrades = {"A+", "A", "A-", "B+", "B", "B-", "C+", "C", "D", "F"}; public static void main(String args[]) throws IOException { System.out.print("What is the file name? "); try { FileInputStream file = new FileInputStream(console.nextLine()); BufferedReader br = new BufferedReader(new InputStreamReader(file)); String line; while((line = br.readLine())!= null) { System.out.println(line); } } catch(IOException e) { System.out.println(e); } String[] letterGrades = {"A+", "A", "A-", "B+", "B", "B-", "C+", "C", "D", "F"}; int [] gradePointValue = {9, 8, 7, 6, 5, 4, 3, 2, 1}; } public static double getGrade(String[]letterGrades) { double grade = 0; if(letterGrades.equals("A+")) { grade = 9; }else if(letterGrades.equals("A")) { grade = 8; }else if(letterGrades.equals("A-")) { grade = 7; }else if(letterGrades.equals("B+")) { grade = 6; }else if(letterGrades.equals("B")) { grade = 5; }else if(letterGrades.equals("B-")) { grade = 4; }else if(letterGrades.equals("C+")) { grade = 3; }else if(letterGrades.equals("C")) { grade = 2; }else if(letterGrades.equals("D")) { grade = 1; } else { letterGrades.equals("F"); grade = 0; } return grade; } }
I am still learning Java, so any help would be greatly appreciated. Thank you guys so much!