I am having trouble in sorting out what i need to do for my first assignment. open a text file, with colon char, 1 student number: 2 student name: 3 5 fields with marks;
a algorithms: b mathematics: c java: d C++: e scripting
open txt file read
open txt file write
open txt file append
write/append per-formatted line to txt file
I could use all the help i can get in getting this right.
thank you for any help

1 student number: 2 student name: 3 5 fields with marks;

example:

B00101:John Lenon:50:60:70:80:90

The marks are given according to the below subject sequence:

a algorithms: b mathematics: c java: d C++: e scripting

So John Lenon with the student number B00101 scored 50 for algorithm, 60 for mathematics, 70 for java, 80 for C++ and 90 for scripting.

Is this correct?.

Member Avatar for hfx642

Lookup tokenizer in the Java docs.
This will help you parse your input string.
Hint:
Your first "word" will be your student number.
Your last 5 "words" will be your marks.
Put together the remaining "words" for your student name.

1 student number: 2 student name: 3 5 fields with marks;

example:

B00101:John Lenon:50:60:70:80:90

The marks are given according to the below subject sequence:

a algorithms: b mathematics: c java: d C++: e scripting

So John Lenon with the student number B00101 scored 50 for algorithm, 60 for mathematics, 70 for java, 80 for C++ and 90 for scripting.

Is this correct?.

this is correct but there are ex
student number 0521: student name: -0.0:25.0:-0.0:45.0:70.0
there is no letter in the student number or the grades there are some students that get no grade hence -0.0 otherwise 0 - 100

As long as data in the file is seperated using (e.g colon or comma), then you can retrieve the data from the file using (e.g FileOutputStream) and split the data using a tokenizer.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.