Hello all again. I know I only come around with questions but I'm seriously stuck. Our teacher gave us an easy program (to make) that reads a .dat file in this order:
student number
first name
last name
quiz total points
program total points
midterm total points
final total points
I have to read in each line into my program (using "/n" newline delimiter) to store information in arrays labeled as student number, student name and average (I have a function for that one). My question is how do you read in things from a file and how does it work?
Here's my huge guess, feel free to laugh.
Just a huge guess, but I'd like to ask for your help. Thanks in advance!
student number
first name
last name
quiz total points
program total points
midterm total points
final total points
I have to read in each line into my program (using "/n" newline delimiter) to store information in arrays labeled as student number, student name and average (I have a function for that one). My question is how do you read in things from a file and how does it work?
Here's my huge guess, feel free to laugh.
Code:
static Scanner inFile = new Scanner(new FileReader(C:\\student.dat"));
for(int i=0; i < average.length(); i++)
{
studentNumber[i] = Int.parseInt();
studentName[i] = String.parseString + " " + String.parseString;
}
Just a huge guess, but I'd like to ask for your help. Thanks in advance!