theres an assignment question that i cant seem to get working. can someone help me. basically fill in the blank lines.
What i am required is to extract the dat file and create ID's for these students. so the output should look like:
99110289 Smith, Daniels
The values derive from the following positions INT=11, EXT=22.
1999/INT/05-02-89/Smith, Daniels
99 got from the year
INT=11
02-89 dateOfBirth
the q5.dat file is:
1999/INT/05-02-89/Smith, Daniels
2000/EXT/01-12-90/Thompson, Bill
2001/INT/21-11-80/Lake, Trevor
2002/INT/13-09-79/Fry, John
import java.io.*;
import java.util.StringTokenizer;
public class Question5
{
public static void main (
String [] args)
{
int totalEnrolments = 0;
String line,
enrolmentYear,
file = "q5.dat",
dateOfBirth,
studentID,
status;
final int INT = 11,
EXT = 22;
StringTokenizer tokens;
try
{
FileReader fr = new FileReader(file);
BufferedReader inFile = new BufferedReader(fr);
line = inFile.readLine();
while (line != null)
{
//i have to do something here. something like extracting substrings...
System.out.println(studentID);
}//end while
inFile.close();
}// end try
catch (IOException e)
{
System.out.println("No File");
}// end catch
System.out.println();
System.out.println("Total number of enrolments: " + totalEnrolments);
}//end method
}end class

[ November 21, 2002: Message edited by: M Du ]