0

hi I'm working on my hw and I have problem
I know how to read file from data and split each line using array

now I want to use arrayList .. I want to read the data from the file and create arrayList and then split each line and create object of type student
the file contain the following

Course Number
Course Name
Semester
ID,program,GPA

I have two class
class Student and class course .. the class student have information about student (id,programand GPA)
the class course contain ( course num,courseName,semester,List<Student> student)
also I add createStudent method .. I'm trying to use polymorphism and ArrayList

this is what I got so far in the main form

public List<Student> createStudent(String fileName) {



List<String> data = FileUtils.readIntoList(fileName);
List<Student> res = new ArrayList();
for(int i =0; i < course.size(); i++){
Course temp = course.get(i);
String num = temp.getCourseNumber();
String name = temp.getCourseName();
String semester = temp.getSemester();
List <Student> s = temp.getStudent();

Course c = new Course(num,name,semester,s);
res.get(i); 

}
return res;

}
2
Contributors
1
Reply
2
Views
4 Years
Discussion Span
Last Post by mvmalderen
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.