I'm reading in a file as a command line argument. The file contains various information that I want to store in different arrays. I'm confused on how to extract the information from the file so I can add it to the arrays. Here's my code so far:
public class GradeBookApp {
public static void main(String[] args) throws IOException {
String name = "";
char[] categoryCodes = new char[5];
String[] categories = new String[5];
double[] categoryWeights = new double[5];
double[][] gradeTable;
GradeBook myGB = new GradeBook (name, categoryCodes,
categories, categoryWeights);
if (args.length > 0) {
for (int i = 0; i < args.length; i++) {
System.out.println("File \"" + args[i]
+ "\" read in and Gradebook object created.");
}
I guess my question is how do I extract the information from the file so I can add it to the arrays.
Here's the file being read in. The first line is the name, the second is the amount of grade categories, the next 5 are the categories and grade weights, and the last ones are the various grades starting with the letter of the category they belong in. These are the values that make up the 2D grade table.
Student1
5
a Activities 0.05
q Quizzes 0.10
p Projects 0.25
e Exams 0.30
f Final 0.30
a100 a95 a100 a100 a100
q90 q80 q100 q80 q80 r90
p100 p95 p100 p85 p100
e77.5 e88
f92