I am trying to assign a number to a letter grade that a user inputs. The user will input a letter such as A, B, or C and then based on what they enter a value is stored in an integer.
I figured the easiest way to do this was setup an array such as:
char[] grade = char[] grade = {'A','B','C','D','F'};
grade[0] = 4;
grade[1] = 3;
// ... as so on
So, whenever a user inputs 'A' for their grade, I use the 4 when I need to.
I am trying to figure out how to read an input (JOptionPane) and read the letter they enter to the corresponding value I have assigned it. How do I go about parsing the letter input based on my array?