Whats up everyone I have a question, but first of all I know how to read a file, write to it and all that good stuff I was wondering how do I manipulate data from one. I want to take this .txt file and compute the gpa by taking the student grade and and number of hours the course is out of the file and doing the math for them. How would I go about doing this I'm kind of stumped. Here is the .txt file.


A123456 John Doe
Term Fall 2011
CS 411 Object Oriented Programming
3 A
CS 211 Introduction to Programming
3 A
CS 560 Data Structures and Algorithms
3 B
CS 680 Software Engineering
3 B+

B654431 Jill Great
Term Fall 2011
CS 411 Object Oriented Programming
3 B+
CS 211 Introduction to Programming
3 A
CS 560 Data Structures and Algorithms
3 A
CS 680 Software Engineering
3 B+
Term Spring 2011
Eng 101 English
3 A
Phy 254 Physics I
3 B+

If you know how to read a file then:
create a data structure in your program to hold the data you will read. eg You could have an arraylist of instances of a Student class that has name etc and a hashtable of courses/grades.
Read the file into the data structure.
Loop through the list of Students and for each student process his courses & grades to compute whatever

Thanks for the help I will give that a try.

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.